Skip to content
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 in Series.replace with timezone-aware datetime columns #11792

Closed
multiloc opened this issue Dec 7, 2015 · 2 comments · Fixed by #21612
Closed

bug in Series.replace with timezone-aware datetime columns #11792

multiloc opened this issue Dec 7, 2015 · 2 comments · Fixed by #21612
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@multiloc
Copy link
Contributor

multiloc commented Dec 7, 2015

Seeing the following behavior in 0.17.1 with the patch from #11715 applied (would raise without the patch):

In [29]: ser = pd.Series([pd.NaT, pd.Timestamp('2015/01/01', tz='UTC')])

# works
In [30]: ser.replace(pd.NaT, pd.Timestamp.min)
Out[30]: 
0    1677-09-22 00:12:43.145225
1     2015-01-01 00:00:00+00:00
dtype: object

# doesn't work
In [31]: ser.replace([np.nan, pd.NaT], pd.Timestamp.min)
Out[31]: 
0                         NaT
1   2015-01-01 00:00:00+00:00
dtype: datetime64[ns, UTC]

# works without timezone-aware datetimes
In [32]: ser = pd.Series([pd.NaT, pd.Timestamp('2015/01/01')])
In [33]: ser.replace([np.nan, pd.NaT], pd.Timestamp.min)
Out[33]: 
0   1677-09-22 00:12:43.145225
1   2015-01-01 00:00:00.000000
dtype: datetime64[ns]
@jreback
Copy link
Contributor

jreback commented Dec 9, 2015

yep, looks like a buggie! (thanks for the multiple reports BTW). interested in a pull-request to fix?

@jreback jreback added this to the Next Major Release milestone Dec 9, 2015
@multiloc
Copy link
Contributor Author

sure, I'll look into it over the weekend

@jreback jreback modified the milestones: Next Major Release, 0.24.0 Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants