groupby UTC timestamp aggregation · Issue #11616 · pandas-dev/pandas (original) (raw)
Hi all,
I've found an inconsistency between pandas 0.17 and 0.16.2 when aggregating on UTC timestamps. Here is a snippet to reproduce the problem:
import numpy as np import pandas as pd
np.random.seed(42)
data = pd.DataFrame({ 'factor': np.random.randint(0, 3, size=60), 'time': pd.date_range('01/01/2000 00:00', periods=60, freq='s', tz='UTC') })
gp = data.groupby('factor')
print(gp['time'].min()) print(gp['time'].max())
On 0.16.2 the output seems correct, i.e it returns timestamps:
In [1]: %run bug_pandas.py
factor
0 2000-01-01 00:00:01+00:00
1 2000-01-01 00:00:07+00:00
2 2000-01-01 00:00:00+00:00
Name: time, dtype: object
factor
0 2000-01-01 00:00:57+00:00
1 2000-01-01 00:00:54+00:00
2 2000-01-01 00:00:59+00:00
Name: time, dtype: object
However on 0.17 it returns timestamps as integers:
In [1]: %run bug_pandas.py
factor
0 946684801000000000
1 946684807000000000
2 946684800000000000
Name: time, dtype: int64
factor
0 946684857000000000
1 946684854000000000
2 946684859000000000
Name: time, dtype: int64
It should be noted that the problem doesn't appear with tz=None
.
Thanks for your help,
Alexandre