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 を作成することは可能ですか? はいの場合、書き出さずに初期化するにはどうすればよいですか? (明らかに、64 x 64 の配列を書き出す必要はありません)
の空の配列を作成しますdtype=object:
dtype=object
a=np.empty((64,64), dtype=object)
次に、タプル (またはその他のもの) を入れます。
for y in range(64): for x in range(64): a[y,x] = (0,0)
実際に最も重要なのは でありdtype=object、そこに任意の Python オブジェクトを配置できます (ただし、ベクトル化された操作の速度は失われます)。