Accessing a large numpy array while preserving its order
问题 I would like to access an numpy array data via an index idx , but still preserving the order in data . Below is an example where the array is accessed with an order different from the one in the original array. In [125]: data = np.array([2, 2.2, 2.5]) In [126]: idx=np.array([1,0]) In [127]: data[idx] Out[127]: array([2.2, 2. ]) I hope to get [2,2.2] instead. Is there a highly efficient way to do so? In my problem setting, I have the data with more than a million floating-point numbers, and