-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: Construct Timestamp with tz correctly near DST border #21407
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
Changes from 7 commits
c5566d5
5d207ea
f4eb827
c8dabe1
795cc39
f171f9f
7e183a8
3dd00d7
ae9dc7b
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 |
|---|---|---|
|
|
@@ -347,10 +347,9 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz, | |
| if tz is not None: | ||
| tz = maybe_get_tz(tz) | ||
|
|
||
| # sort of a temporary hack | ||
| if ts.tzinfo is not None: | ||
| if hasattr(tz, 'normalize') and hasattr(ts.tzinfo, '_utcoffset'): | ||
|
||
| ts = tz.normalize(ts) | ||
| ts = ts.astimezone(tz) | ||
| obj.value = pydatetime_to_dt64(ts, &obj.dts) | ||
| obj.tzinfo = ts.tzinfo | ||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -992,6 +992,16 @@ def test_boolean_comparison(self): | |
| result = df == tup | ||
| assert_frame_equal(result, expected) | ||
|
|
||
| @pytest.mark.parametrize('tz', [None, 'America/New_York']) | ||
| def test_boolean_compare_transpose_tzindex_with_dst(self, tz): | ||
|
||
| # GH 19970 | ||
| idx = date_range('20161101', '20161130', freq='4H', tz=tz) | ||
| df = DataFrame({'a': range(len(idx)), 'b': range(len(idx))}, | ||
| index=idx) | ||
| result = df.T == df.T | ||
| expected = DataFrame(True, index=list('ab'), columns=idx) | ||
| assert_frame_equal(result, expected) | ||
|
|
||
| def test_combine_generic(self): | ||
| df1 = self.frame | ||
| df2 = self.frame.loc[self.frame.index[:-5], ['A', 'B', 'C']] | ||
|
|
||
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.
move to 0.23.2