-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
ENH: Allow to reset tz from DatetimeIndex holding time representation #7812
Comments
+1. What if we support idx.tzinfo=None and that operates appropriately on the underlying data? |
I agree with @rockg (maybe I don't think this very common, so full function I don't think is necessary (though I guess can't hurt). |
+1 : I suspect this is more common than imagined. :) |
@nehalecky hahh! ok, so method and setter? how do you do this now?
|
Initial idea may be generalized by adding
|
what about just allowing though this may be more confusing |
I think None is a great idea and I don't think it's too confusing. |
should this work only on one if tz_convert/tz_localize? side issue do we support setting directly of a tz? (which would convert/localize as appropriate) |
I was going to say just tz_localize before but it probably does make more sense with tz_convert (converting a tz to a non-tz). I think supporting both is okay. I don't think we support directly setting tz except through tz_localize. |
ok, so:
|
@jreback, thanks, and yeah, tz naive At first, I brute-forced the stripping of the underlying timestamp of tz info via +1 on the |
Hmm, both
The required operation is "holding subjective time and reset timezone", thus I feel |
@rockg ? |
my2c: I think we should do just |
I'm fine with just |
in #7852
is this confusing / problem / ok? (I guess as opposed to just removing it no matter what tz it is) |
Ah, my explanation made incorrect impression. What I meant is
|
ok, maybe show this example (I haven't looked at the doc updates yet). to make this very clear. |
Nice work @sinhrks. Quick thought: The examples could possibly convey more understanding of functionality if, in addition to the examples above, an included sample with timestamps with tz that weren't exact UTC hour offsets? e.g., In [25]: t = pd.Timestamp('2014-01-01 10:00', tz='Asia/Tokyo')
In [26]: t.tz_convert(None)
Out[26]: Timestamp('2014-01-01 01:00:00')
In [27]: t.tz_localize(None)
Out[26]: Timestamp('2014-01-01 10:00:00') Other than that, I think this looks grand. :) |
Thanks, looks more clear. Docs in #7852 uses US timezone and different hours from UTC offset, there should be no problem. |
There looks no easy way to remove tz from tz-aware
DatetimeIndex
holding the timestamp represented. What required is inverse operation oftz_localize
.In my case, there are some globally distributed data sources which holds local timezones. And want to merge them and analyze based on local subjective times (business hours, etc).
The text was updated successfully, but these errors were encountered: