> For the complete documentation index, see [llms.txt](https://stb11816.gitbook.io/python_note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stb11816.gitbook.io/python_note/web/numpy.md).

# numpy

## ndarray.tolist()

```python
a = np.array([1, 2])
a.tolist()
# [1, 2]

a = np.array([[1, 2], [3, 4]])
list(a)
# [array([1, 2]), array([3, 4])]
a.tolist()
# [[1, 2], [3, 4]]
```

## 平均值

```python
np.mean([1, 2, 3])
# 2.0

np.average([1, 2, 3])
# 2.0
```

參考資料：\
比較差異 - <https://stackoverflow.com/questions/20054243/np-mean-vs-np-average-in-python-numpy>
