# Creating Numpy Arrays

Want to learn more? I recommend these Python books: Python for Data Analysis, Python Data Science Handbook, and Introduction to Machine Learning with Python.

```# Import Modules
import numpy as np
```
```# Create a list
regimentSize = [534, 5468, 6546, 542, 9856, 4125]
```
```# Create a ndarray from the regimentSize list
regimentSizeArray = np.array(regimentSize); regimentSizeArray
```
```array([ 534, 5468, 6546,  542, 9856, 4125])
```
```# What are the number of dimensions of the array?
regimentSizeArray.ndim
```
```1
```
```# What is the shape of the array?
regimentSizeArray.shape
```
```(6,)
```

## Nested Lists To Multidimensional Arrays

```# Create two lists
regimentSizePreWar = [534, 5468, 6546, 542, 9856, 4125]
regimentSizePostWar = [234, 255, 267, 732, 235, 723]
```
```# Create a ndarray from a nested list
regimentSizePrePostArray = np.array([regimentSizePreWar, regimentSizePostWar]); regimentSizePrePostArray
```
```array([[ 534, 5468, 6546,  542, 9856, 4125],
[ 234,  255,  267,  732,  235,  723]])
```
```# What are the number of dimensions of the array?
regimentSizePrePostArray.ndim
```
```2
```
```# What is the shape of the array?
regimentSizePrePostArray.shape
```
```(2, 6)
```