-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
BUG: coercion of mixed dt-aware data in Series constructor #13051
Comments
So this is correct if you construct the Series correctly.
I suppose this is a bug, we should not be coercing a non-tz-aware AND a dt-aware.
However as a user you have to be aware that putting tz-aware and tz-naive data together is basically meaningless. |
cc @sinhrks |
Good to keep in mind, sorry my example wasn't the best. I don't think the breakage in my client code was due to a mixing of tz-aware and tz-native data though, of course it is possible I wasn't using the API correctly. Here's some more testing: In 0.18.0 this is the case: >>> pd.Series(dt_localized).apply(hour_of_day)
0 2
dtype: int64
# Adding dtype results in expected behavior.
>>> pd.Series(dt_localized, dtype=object).apply(hour_of_day)
0 19
dtype: int64 However in 0.16 and in master it does give the result I expect: >>> pd.Series(dt_localized).apply(hour_of_day)
0 19
dtype: int32 |
@frankcleary what you are doing is quite inefficient, don't use apply expect as a last resort. Series holds a single dtype, using
|
I ran into an issue where the behavior of
.apply()
changed from 0.16 to 0.17, causing different results on tz aware data. Extracting the hour of day from datetimes is different forSeries(x).apply(func)
vsfunc(x)
. Below is a minimal example of the issue in 0.17, it seems the behavior is the same in 0.18 but different (though still not equal) on master, also shown below.On 0.17.1 and 0.18.0:
On 0.16.2 (what I expected):
On master:
Expected Output
I would expect the output to be [2, 19], as in 0.16, and matching map(f, data).
The text was updated successfully, but these errors were encountered: