[Python] Indexing An Array With Another Array with numpy
2017-12-18 21:32
357 查看
NumPy Reference: Indexing
Integer array indexing: Select array elements with another arraydef indexing(): a = np.random.rand(5) print(a) #[ 0.71899463 0.50556877 0.8397599 0.37655158 0.88041567] indices = np.array([1,1,2,3]) # access index of 1,1,2,3 print(a[indices]) #[ 0.50556877 0.50556877 0.8397599 0.37655158] if __name__ == "__main__": indexing()
相关文章推荐
- ValueError: setting an array element with a sequence. tensorflow numpy
- Python-numpy逻辑报错:The truth value of an array with more than one element is ambiguous
- Python-numpy逻辑报错:The truth value of an array with more than one element is ambiguous. Us
- ValueError: setting an array element with a sequence.
- python Numpy—— 数组array
- Python中的二维数组(list与numpy.array)
- [Leetcode,python] Find All Numbers Disappeared in an Array 寻找数组中消失的数字
- Why do some structures end with an array of size 1?
- Python Numpy的数组array和矩阵matrix
- python中的numpy库的numpy.asarray
- Python中的二维数组实例(list与numpy.array)
- python-opencv:ImportError: numpy.core.multiarray failed to import
- Python中的二维数组(list与numpy.array)
- 9. 11. 30. 从asList到toArray转换 -Convert a List (ArrayList) to an Array with zero length array
- 【LeetCode with Python】Remove Duplicates from Sorted Array II
- AGG第四十二课 Blitting an image over another with transparency
- 基于Python Numpy的数组array和矩阵matrix详解
- [Leetcode,python] Find All Numbers Disappeared in an Array 寻找数组中消失的数字
- 【LEETCODE】384- Shuffle an Array [Python]
- Python之路——numpy各函数简介之生成数组函数(Array creation routines)