-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Aggregating over an integer on an empty DataFrame causes datetime64 types to convert to float64 #7649
New issue
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
Comments
can you put the frame creation at the top of your example as well. easiest to diagnose when can simply copy-paste |
I'm not sure of a clean way to generate a DataFrame with timestamps, but this works in reproducing the error: df = pd.DataFrame({'ref':[1, 1, 2, 2], 'localtime':4*['2014-06-25 14:11:11.753597'], 'size':[100, 200, 300, 400]})
df.localtime = pd.to_datetime(df.localtime) |
works ok in master/0.14.1 (releasing soon). fixed here: #7593
|
Ah, and it kept your index as |
Possibly related to issue #7574:
Suppose I have a DataFrame:
If I aggregate over an integer, the resulting types are as expected:
However, if I aggregate on an empty DataFrame, then my timestamp's type is converted from datetime64 to float64:
The text was updated successfully, but these errors were encountered: