Skip to content

Instantly share code, notes, and snippets.

@michaelwills
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelwills/37ed3c9d8db83dbf3c9c to your computer and use it in GitHub Desktop.
Save michaelwills/37ed3c9d8db83dbf3c9c to your computer and use it in GitHub Desktop.
Get the timestamp of a sliced row in a pandas dataframe
from pandas import *
from numpy import *
from numpy.matlib import randn
dates = date_range('1/1/2000', periods=8)
df = DataFrame(randn(8, 4), index=dates, columns=['A', 'B', 'C', 'D'])
i = df.loc['20000101']
In [157]:i.name
Out[157]: Timestamp('2000-01-01 00:00:00', tz=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment