Skip to content

Commit 0e4c499

Browse files
committed
Move change to bug and rename into result and expected
1 parent 02aa59f commit 0e4c499

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

doc/source/whatsnew/v0.21.1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Other Enhancements
2222
^^^^^^^^^^^^^^^^^^
2323

2424
- :meth:`Timestamp.timestamp` is now available in Python 2.7. (:issue:`17329`)
25-
- :class:`DatetimeIndex` is now timezone aware when using strings as labels for indexing (:issue:`16785`)
2625
-
2726

2827
.. _whatsnew_0211.deprecations:
@@ -62,6 +61,7 @@ Bug Fixes
6261
- Bug in ``pd.Series.rolling.skew()`` and ``rolling.kurt()`` with all equal values has floating issue (:issue:`18044`)
6362
- Bug in ``pd.DataFrameGroupBy.count()`` when counting over a datetimelike column (:issue:`13393`)
6463
- Bug in ``pd.concat`` when empty and non-empty DataFrames or Series are concatenated (:issue:`18178` :issue:`18187`)
64+
- Bug in :class:`DatetimeIndex` when partial string label indices are actually timezone aware (:issue:`16785`)
6565

6666
Conversion
6767
^^^^^^^^^^

pandas/tests/indexing/test_partial.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -648,17 +648,16 @@ def test_access_timezoned_datetimeindex_with_timezoned_label(self):
648648
df = pd.DataFrame(index=first_january, data=np.arange(len(
649649
first_january)))
650650

651-
former_naive_endpoint_df = df[
651+
result = df[
652652
"2016-01-01T00:00-02:00":"2016-01-01T02:03"
653653
]
654654

655-
former_non_naive_endpoint_df = df[
655+
expected = df[
656656
pd.Timestamp("2016-01-01T00:00-02:00"):
657657
pd.Timestamp("2016-01-01T02:03")
658658
]
659659

660-
tm.assert_frame_equal(former_naive_endpoint_df,
661-
former_non_naive_endpoint_df)
660+
tm.assert_frame_equal(result, expected)
662661

663662
def test_access_naive_datetimeindex_with_timezoned_label(self):
664663

@@ -672,11 +671,11 @@ def test_access_naive_datetimeindex_with_timezoned_label(self):
672671
first_january)))
673672

674673
with tm.assert_produces_warning(UserWarning):
675-
former_naive_endpoint_df = df["2016-01-01T00:00-02:00":
676-
"2016-01-01T02:03"]
674+
result = df["2016-01-01T00:00-02:00":"2016-01-01T02:03"]
677675

678-
former_non_naive_endpoint_df = df[pd.Timestamp(
679-
"2016-01-01T00:00-02:00"):pd.Timestamp("2016-01-01T02:03")]
676+
expected = df[
677+
pd.Timestamp("2016-01-01T00:00-02:00"):
678+
pd.Timestamp("2016-01-01T02:03")
679+
]
680680

681-
tm.assert_frame_equal(former_non_naive_endpoint_df,
682-
former_naive_endpoint_df)
681+
tm.assert_frame_equal(expected, result)

0 commit comments

Comments
 (0)