numpy&scipy学习中碰到的疑惑

来源:互联网 发布:淘宝引流软件有用吗 编辑:程序博客网 时间:2024/06/06 05:43

numpy和matlab的区别

英文原版
中文翻译版

1. numpy.ix_(*arg)

Construct an open mesh from multiple sequences.
This function takes N 1-D sequences and returns N outputs with N dimensions each, such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all N dimensions.

a[np.ix_([com],[ral])] 和a[[com],[ral]]之间存在差别

import numpy as npA = np.arange(12).reshape((3,4))print(A)print(A[[1,2],[0,2]])print('\n'*2)print(A[np.ix_([1,2],[0,2])])

输出

[[ 0  1  2  3] [ 4  5  6  7] [ 8  9 10 11]][ 4 10][[ 4  6] [ 8 10]]

2.

原创粉丝点击