We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
DatetimeIndex.tz_localize preserves name.
DatetimeIndex.tz_localize
import pandas as pd idx = pd.date_range('2011-01-01', periods=5, freq='M', name='x') idx # DatetimeIndex(['2011-01-31', '2011-02-28', '2011-03-31', '2011-04-30', '2011-05-31'], # dtype='datetime64[ns]', name=u'x', freq='M', tz=None) idx.tz_localize('US/Eastern') # DatetimeIndex(['2011-01-31 00:00:00-05:00', '2011-02-28 00:00:00-05:00', # '2011-03-31 00:00:00-04:00', '2011-04-30 00:00:00-04:00', # '2011-05-31 00:00:00-04:00'], # dtype='datetime64[ns]', name=u'x', freq='M', tz='US/Eastern')
But Series doesn't. I don't check all methods which can return Series yet.
Series
s = pd.Series(idx) s #0 2011-01-31 #1 2011-02-28 #2 2011-03-31 #3 2011-04-30 #4 2011-05-31 # Name: x, dtype: datetime64[ns] # NG, name is reset s2 = s.dt.tz_localize('US/Eastern') s2 #0 2011-01-31 00:00:00-05:00 #1 2011-02-28 00:00:00-05:00 #2 2011-03-31 00:00:00-04:00 #3 2011-04-30 00:00:00-04:00 #4 2011-05-31 00:00:00-04:00 # dtype: object # NG, name is reset s2.name = 'x' s2.dt.tz_convert('US/Pacific') #0 2011-01-30 21:00:00-08:00 #1 2011-02-27 21:00:00-08:00 #2 2011-03-30 21:00:00-07:00 #3 2011-04-29 21:00:00-07:00 #4 2011-05-30 21:00:00-07:00 # dtype: object # NG, name is reset s.dt.normalize() #0 2011-01-31 #1 2011-02-28 #2 2011-03-31 #3 2011-04-30 #4 2011-05-31 # dtype: datetime64[ns]
The text was updated successfully, but these errors were encountered:
8c41e62
Successfully merging a pull request may close this issue.
DatetimeIndex.tz_localize
preserves name.But
Series
doesn't. I don't check all methods which can returnSeries
yet.The text was updated successfully, but these errors were encountered: