Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
numpy 配列があり、インデックスに基づいていくつかの列を削除したいと考えています。そのための組み込み関数や、そのような操作のためのエレガントな方法はありますか?
何かのようなもの:
arr = [234, 235, 23, 6, 3, 6, 23] elim = [3, 5, 6] arr = arr.drop[elim] output: [234, 235, 23, 3]
を使用するnumpy.deleteと、新しい配列が返されます。
numpy.delete
import numpy as np arr = np.array([234, 235, 23, 6, 3, 6, 23]) elim = [3, 5, 6] np.delete(arr, elim)