:
df_eq = {'col1' : [list, of, column, data],
'col2' : [list, of, column, data],
...,
'coln-1' : [list, of, column, data],
'coln' : [list, of, column, data]}
次に、あなたがloc
のようなものを使用することができます。あなたは、パンダを持っているパンダを取得しない場合はまた、インデックスnumpy
はpandas
Ar_data = np.array([["gyrados","raichu","mu","dragonair","vaporeon"],["water","electric","normal","dragon","water"], [0,0,0,1,2]]).T
Ar_data
# array([['gyrados', 'water', '0'],
# ['raichu', 'electric', '0'],
# ['mu', 'normal', '0'],
# ['dragonair', 'dragon', '1'],
# ['vaporeon', 'water', '2']],
# dtype='<U9')
# Index w/ ints `.iloc`
Ar_data[3,1]
# 'dragon'
fields = ["pokemon","status","meta"]
observations = ["p1","p2","p3","p4","p5"]
# Index w/ labels `.loc`
Ar_data[3,fields.index("pokemon")]
# 'dragonair'
Ar_data[observations.index("p4"),fields.index("pokemon")]
# 'dragonair'
# Time it
DF_data = pd.DataFrame(Ar_data, columns=fields, index=observations)
%timeit DF_data.iloc[3,1]
%timeit Ar_data[3,1]
# 10000 loops, best of 3: 129 µs per loop
# The slowest run took 21.69 times longer than the fastest. This could mean that an intermediate result is being cached.
# 1000000 loops, best of 3: 384 ns per loop
/wのインデックスよりも高速です。組み込みのdictオブジェクトを使用して750 Mbのファイルをキャプチャすると、20 GB以上のRAMが必要になります。パンダは4のように読み込みます。 https://www.youtube.com/watch?v=lsJLLEwUYZM – kpie
numpyを使用できますか?それ以外の場合は、[名前付きタプル](https://docs.python.org/3/library/collections.html#collections.namedtuple) – JGreenwell