We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http://stackoverflow.com/questions/19458361/python-pandas-groupby-date-and-accessing-each-group-by-timestamp
In [2]: df= pd.DataFrame({'DATE' : ['10-Oct-2013', '10-Oct-2013', '10-Oct-2013', '11-Oct-2013', '11-Oct-2013', '11-Oct-2013'],'VAL' : [1,2,3,4,5,6]}) In [3]: df['DATE'] = pd.to_datetime(df['DATE']) In [4]: df Out[4]: DATE VAL 0 2013-10-10 00:00:00 1 1 2013-10-10 00:00:00 2 2 2013-10-10 00:00:00 3 3 2013-10-11 00:00:00 4 4 2013-10-11 00:00:00 5 5 2013-10-11 00:00:00 6 In [5]: g = df.groupby('DATE') In [8]: key = g.groups.keys()[0] In [9]: key Out[9]: numpy.datetime64('2013-10-09T20:00:00.000000000-0400') In [10]: g.indices Out[10]: {1381363200000000000L: array([0, 1, 2]), 1381449600000000000L: array([3, 4, 5])} In [11]: g.get_group(key.astype('i8')) Out[11]: DATE VAL 0 2013-10-10 00:00:00 1 1 2013-10-10 00:00:00 2 2 2013-10-10 00:00:00 3
so works, but not very friendly in addition on windows, the following is needed for the selection to succeed
g.get_group(long(key.astype('i8')))
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
http://stackoverflow.com/questions/19458361/python-pandas-groupby-date-and-accessing-each-group-by-timestamp
so works, but not very friendly
in addition on windows, the following is needed for the selection to succeed
g.get_group(long(key.astype('i8')))
The text was updated successfully, but these errors were encountered: