2016-11-10 4 views

答えて

4

あなたが最後にdocsで情報を見つけることができます。

明示的に値を取得するための(非推奨df.get_valueに等量( 'A'、 'A'))

# this is also equivalent to ``df1.at['a','A']`` 
In [55]: df1.loc['a', 'A'] 
Out[55]: 0.13200317033032932 

しかしそれを使用すれば警告はありません。

しかし、もし

チェック Index.get_value:1次元ndarrayからの値の

高速検索。あなたは

をやっているか知っている場合にのみiatatlocixを使用するので、私はより良いと思うこれをされる使用。

タイミング

df = pd.DataFrame({'A':[1,2,3], 
        'B':[4,5,6], 
        'C':[7,8,9], 
        'D':[1,3,5], 
        'E':[5,3,6], 
        'F':[7,4,3]}) 

print (df) 

In [93]: %timeit (df.loc[0, 'A']) 
The slowest run took 6.40 times longer than the fastest. This could mean that an intermediate result is being cached. 
10000 loops, best of 3: 177 µs per loop 

In [96]: %timeit (df.at[0, 'A']) 
The slowest run took 17.01 times longer than the fastest. This could mean that an intermediate result is being cached. 
100000 loops, best of 3: 7.61 µs per loop 

In [94]: %timeit (df.get_value(0, 'A')) 
The slowest run took 23.49 times longer than the fastest. This could mean that an intermediate result is being cached. 
100000 loops, best of 3: 3.36 µs per loop 
+0

になります...パンダ自体は 'を使用していますget_value() '内部で - https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexing.py#L77 – MaxU

+0

よろしいですか?何も思いつきません。 – jezrael

+0

iat/iloc、at/loc、およびixの違いを確認するには、[この質問](http://stackoverflow.com/questions/31593201/pandas-iloc-vs-ix-vs-loc-explanation) –

関連する問題