Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
llinjupt committed May 7, 2019
1 parent 6686156 commit c9d5cdd
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ logspace() 等价于先等差再对元素以底数 base 乘幂:
>>>
[ 1. 2. 4. 8. 16. 32.]
行列操作
-------------
行列合并和扩展
--------------

合并行或列
~~~~~~~~~~~~~
Expand Down Expand Up @@ -1160,7 +1160,24 @@ A[..., 1] 则是先找到最后一维的元素,然后拿出其中索引为 [1]
[10]
[20]]
在获取行时,可以省略二维索引,例如 A[1] 和 A[1, :] 是等价的。
在获取行时,可以省略二维索引,例如 A[1] 和 A[1, :] 是等价的。可以将行赋值给多个元素:

.. code-block:: python
:linenos:
:lineno-start: 0
A = np.arange(4).reshape(2,2)
a,b=A
print(a)
print(b)
>>>
[0 1]
[2 3]
# 以上操作等价于
a = A[0]
b = A[1]
为任意行列赋值
````````````````
Expand Down Expand Up @@ -1478,7 +1495,7 @@ reshape
::

reshape(a, newshape, order='C')

reshape() 函数对输入数组使用新的 newshape 进行变形,返回新数组,数组元素是原数组引用,不会复制。

使用 reshape() 必须满足原数组的大小和变形后数组大小一致。
Expand Down

0 comments on commit c9d5cdd

Please sign in to comment.