Hopefully this is a quick and simple one. Having looked through the entirity of the pandas.DataFrame documentation I can't quite seem to find exactly what I need. I have a DataFrame as:
           StartDate          End Date
0   10/11/2014 00:00  10/12/2014 12:00
1   12/01/2015 08:00  31/01/2015 07:59
2   15/01/2015 00:00  19/02/2015 15:43
Say, for example, I want to access the value at StartDate column index value 2...i.e, 15/01/2015 00:00 how is this achieved?
Use loc:
print (df.loc[2, 'StartDate'])
15/01/2015 00:00
or faster at:
print (df.at[2, 'StartDate'])
15/01/2015 00:00
In [199]: %timeit (df.loc[2, 'StartDate'])
10000 loops, best of 3: 147 µs per loop
In [200]: %timeit (df.at[2, 'StartDate'])
100000 loops, best of 3: 6.3 µs per loop
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With