Browse Source

Improve numpy & matplotlib description

pull/5/head
bushuhui 3 years ago
parent
commit
83aa2d580c
2 changed files with 4 additions and 146 deletions
  1. +2
    -144
      1_numpy_matplotlib_scipy_sympy/1-numpy_tutorial.ipynb
  2. +2
    -2
      1_numpy_matplotlib_scipy_sympy/2-matplotlib_tutorial.ipynb

+ 2
- 144
1_numpy_matplotlib_scipy_sympy/1-numpy_tutorial.ipynb View File

@@ -11,9 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"最新的[IPython notebook](http://ipython.org/notebook.html)课程可以在[http://github.com/jrjohansson/scientific-python-lectures](http://github.com/jrjohansson/scientific-python-lectures) 找到.\n",
"\n",
"其他有关这个课程的参考书在这里标注出[http://jrjohansson.github.io](http://jrjohansson.github.io).\n"
"NumPy是Python中科学计算的基本软件包。它是一个Python库,提供多维数组对象、各种派生类(如掩码数组和矩阵)和各种例程,用于对数组进行快速操作,包括数学、逻辑、形状操作、排序、选择、I/O、离散傅立叶变换、基本线性代数、基本统计操作、随机模拟等等。Numpy作为Python数据计算的基础广泛应用到数据处理、信号处理、机器学习等领域。"
]
},
{
@@ -2050,146 +2048,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 6.3 take"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`take` 函数和上面描述的花式索引类似"
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-3, -2, -1, 0, 1, 2])"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v2 = np.arange(-3,3)\n",
"v2"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-2, 0, 2])"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"row_indices = [1, 3, 5]\n",
"v2[row_indices] # 花式索引"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-2, 0, 2])"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v2.take(row_indices)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"但是`take`也作用在列表和其他的物体上:"
]
},
{
"cell_type": "code",
"execution_count": 94,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-2, 0, 2])"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.take([-3, -2, -1, 0, 1, 2], row_indices)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 6.4 choose"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"通过从几个数组中选择元素来构造一个数组:"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 5, -2, 5, -2])"
]
},
"execution_count": 95,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"which = [1, 0, 1, 0]\n",
"choices = [[-2,-2,-2,-2], [5,5,5,5]]\n",
"\n",
"np.choose(which, choices)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 7. 线性代数"
]
},
@@ -4984,7 +4842,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.7.9"
}
},
"nbformat": 4,


+ 2
- 2
1_numpy_matplotlib_scipy_sympy/2-matplotlib_tutorial.ipynb View File

@@ -446,7 +446,7 @@
"* [Image tutorial](https://matplotlib.org/users/image_tutorial.html)\n",
"* [手把手教你用Python做数据可视化](https://mp.weixin.qq.com/s/3Gwdjw8trwTR5uyr4G7EOg)\n",
"* matplotlib Gallery\n",
" - https://matplotlib.org/gallery.html\n",
" - https://www.matplotlib.org.cn/gallery/\n",
" - https://github.com/rasbt/matplotlib-gallery"
]
}
@@ -467,7 +467,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.7.9"
}
},
"nbformat": 4,


Loading…
Cancel
Save