Johan Nilssons Lifestream

Performances for different ways of accessing dataframes in Python

I am just studying Python Pandas Data Frame and I saw

%timeit

then I compare a few Dataframe, Below is an example of performances for different ways of accessing data frames that are highly relevant when the datasets become large.

so

%timeit data.ix[0,0]

10000 loops, best of 3: 159 µs per loop

%timeit data.loc[0,'nation']

10000 loops, best of 3: 158 µs per loop

%timeit data.iloc[0,0]

10000 loops, best of 3: 132 µs per loop

%timeit data.iat[0,0]

100000 loops, best of 3: 5.9 µs per loop

and you can see data.iat[0,0] hugely different from others.

My question is why .iat different than others and how is working? Can we work with any data?

via Stack Overflow

blog comments powered by Disqus
Get the source for phplifestream at Github