-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: pandas Timestamp tz_localize and tz_convert do not preserve freq
attribute
#25247
Changes from 6 commits
bb5731d
8910104
bdd8b2e
64b1a88
9fc0b0a
c65a35c
d4a1515
2734a3b
e514a23
89af164
45d7b01
6666ea5
d923ddf
115b87c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -780,6 +780,13 @@ def test_hash_equivalent(self): | |
stamp = Timestamp(datetime(2011, 1, 1)) | ||
assert d[stamp] == 5 | ||
|
||
def test_tz_convert_freq(self, tz_naive_fixture): | ||
# GH25241 | ||
t1 = Timestamp('2019-01-01 10:00', freq='H') | ||
assert t1.tz_localize(tz=tz_naive_fixture).freq == t1.freq | ||
t2 = Timestamp('2019-01-02 12:00', tz='UTC', freq='T') | ||
assert t2.tz_convert(tz='UTC') == t2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to assert that the Timestamp
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahh, nice catch!! t1 = pd.Timestamp('2018-01-01 10:00', freq='H')
t2 = pd.Timestamp('2018-01-01 10:00')]) and |
||
|
||
|
||
class TestTimestampNsOperations(object): | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you specify
Timestamp.tz_localize
andTimestamp.tz_convert
? Then you can remove the additionalTimestamp
towards the end.Double back ticks around
freq
as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks for your review! @mroeschke