You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to produce a stand-alone example but couldn't so far. Maybe the answer is already apparent though. This started happening just recently (maybe after updated pandas to 0.17.1) but worked well before. I'm doing a multi-column agg in a groupby. One of the columns is a datetime of which I want the first element:
This reproduces it (it is the timezone that is the trigger):
In [1]: pd.__version__
Out[1]: u'0.17.1'
In [2]: df = pd.DataFrame({'col':['a','a','b','b'], 'date':pd.date_range('2015-0
1-01', periods=4, utc=True)})
In [3]: df.groupby('col').first()
Out[3]:
date
col
a 2015-01-01
b 2015-01-03
In [4]: df.groupby('col').agg({'date': 'first'})
Out[4]:
date
col
a 2015-01-01
b 2015-01-03
In [5]: df['date'] = df['date'].dt.tz_localize('utc')
In [6]: df.groupby('col').first()
Out[6]:
date
col
a 2015-01-01 00:00:00+00:00
b 2015-01-03 00:00:00+00:00
In [7]: df.groupby('col').agg({'date': 'first'})
Out[7]:
date
col
a 1420070400000000000
b 1420243200000000000
I tried to produce a stand-alone example but couldn't so far. Maybe the answer is already apparent though. This started happening just recently (maybe after updated pandas to 0.17.1) but worked well before. I'm doing a multi-column
agg
in a groupby. One of the columns is a datetime of which I want the first element:Works fine, however:
Expected Output
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: