Question #374
Submitted by

**Answiki**on 01/11/2021 at 03:30:56 PM UTC# How to create an NumPy array from a list?

Merged questions

Answer
Submitted by

**Answiki**on 01/11/2021 at 03:35:00 PM UTCThe best way to create a NumPy array from a list is to use the method `numpy.array()`

, here is an example:

```
>>> import numpy as np
>>> list = [[1, 2], [3, 4], [5, 6]]
>>> a = np.array(list)
array([[1, 2],
[3, 4],
[5, 6]])
```

Answer by

**Answiki**on 01/11/2021 at 03:35:00 PMThe best way to create a NumPy array from a list is to use the method `numpy.array()`

, here is an example:

```
>>> import numpy as np
>>> list = [[1, 2], [3, 4], [5, 6]]
>>> a = np.array(list)
array([[1, 2],
[3, 4],
[5, 6]])
```

Answer by

**Answiki**on 01/11/2021 at 03:33:59 PMThe best way to create a NumPy array from a list is to use the method `numpy.array()`

, here is an example:

```
>>> import numpy as np
>>> list = [[1, 2], [3, 4], [5, 6]]
>>> a = np.array(list)
array([[1, 2],
[3, 4],
[5, 6]])
```

Answer by

**Answiki**on 01/11/2021 at 03:33:18 PM`numpy.array()`

, here is an example:

```
>>> import numpy as np
>>> a = np.array([[1, 2], [3, 4], [5, 6]])
array([[1, 2],
[3, 4],
[5, 6]])
```

Question by

**Answiki**01/11/2021 at 03:30:56 PM
How to create an NumPy array from a list?

# | ID | Query | URL | Count |
---|

Icons proudly provided by Friconix.