-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Resolving Index Resetting for tz_localize #43226
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 9 commits
6182afd
056dd9c
f92a566
f0ac5ce
9e8ef7f
b96fb98
5820cee
8ff3242
3308de4
b1afd7b
a30fc1e
8f72848
d39865f
48b296f
4645289
444372a
0222f64
10a3cda
9101359
2966209
d57c7d3
a275508
374c476
0f02afa
ed380c9
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 |
---|---|---|
|
@@ -25,8 +25,8 @@ Fixed regressions | |
|
||
Bug fixes | ||
~~~~~~~~~ | ||
- Bug in :meth:`.DataFrameGroupBy.agg` and :meth:`.DataFrameGroupBy.transform` with ``engine="numba"`` where ``index`` data was not being correctly passed into ``func`` (:issue:`43133`) | ||
- | ||
- Bug in :meth:`.DataFrameGroupBy.agg` and :meth:`.DataFrameGroupBy.transform` with engine="numba" where index data was not being correctly passed into func (:issue:`43133`) | ||
- Fixed bug in :func:`__new__` of :class:`CombinedDatetimelikeProperties` maintains index of Categorical Datetime series (:issue:`43080`) | ||
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.
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. Ok I will make the necessary changes , 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. 1.3.3 is typically for regressions or bugs for very recently added features |
||
|
||
.. --------------------------------------------------------------------------- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from pandas._libs.tslibs import timezones | ||
|
||
from pandas import ( | ||
CategoricalDtype, | ||
DatetimeIndex, | ||
NaT, | ||
Series, | ||
|
@@ -41,6 +42,23 @@ def test_series_tz_localize_ambiguous_bool(self): | |
result = ser.dt.tz_localize("US/Central", ambiguous=[False]) | ||
tm.assert_series_equal(result, expected1) | ||
|
||
def test_series_tz_localize_matching_index(self): | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Matching the index of the result with that of the original series | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# GH 43080 | ||
dt_series = Series( | ||
date_range(start="2021-01-01T02:00:00", periods=5, freq="1D"), | ||
index=[2, 6, 7, 8, 11], | ||
) | ||
cat_series = dt_series.astype(CategoricalDtype()) | ||
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. Can you construct without astype? 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. yeah , I have done that . |
||
result = cat_series.dt.tz_localize("Europe/Berlin") | ||
expected = Series( | ||
date_range( | ||
start="2021-01-01T02:00:00", periods=5, freq="1D", tz="Europe/Berlin" | ||
), | ||
index=[2, 6, 7, 8, 11], | ||
) | ||
tm.assert_series_equal(result, expected) | ||
|
||
@pytest.mark.parametrize("tz", ["Europe/Warsaw", "dateutil/Europe/Warsaw"]) | ||
@pytest.mark.parametrize( | ||
"method, exp", | ||
|
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.
Please revert the changes to this entry.