Skip to content

Commit 668f91a

Browse files
mroeschkeTomAugspurger
authored andcommitted
TST: DatetimeIndex and its Timestamp elements returning same .weekofyear with tz (#16181)
1 parent de87344 commit 668f91a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/source/whatsnew/v0.20.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ Conversion
15801580

15811581
- Bug in ``Timestamp.replace`` now raises ``TypeError`` when incorrect argument names are given; previously this raised ``ValueError`` (:issue:`15240`)
15821582
- Bug in ``Timestamp.replace`` with compat for passing long integers (:issue:`15030`)
1583-
- Bug in ``Timestamp`` returning UTC based time/date attributes when a timezone was provided (:issue:`13303`)
1583+
- Bug in ``Timestamp`` returning UTC based time/date attributes when a timezone was provided (:issue:`13303`, :issue:`6538`)
15841584
- Bug in ``Timestamp`` incorrectly localizing timezones during construction (:issue:`11481`, :issue:`15777`)
15851585
- Bug in ``TimedeltaIndex`` addition where overflow was being allowed without error (:issue:`14816`)
15861586
- Bug in ``TimedeltaIndex`` raising a ``ValueError`` when boolean indexing with ``loc`` (:issue:`14946`)

pandas/tests/indexes/datetimes/test_misc.py

+8
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ def test_datetimeindex_accessors(self):
334334
for ts, value in tests:
335335
assert ts == value
336336

337+
# GH 6538: Check that DatetimeIndex and its TimeStamp elements
338+
# return the same weekofyear accessor close to new year w/ tz
339+
dates = ["2013/12/29", "2013/12/30", "2013/12/31"]
340+
dates = DatetimeIndex(dates, tz="Europe/Brussels")
341+
expected = [52, 1, 1]
342+
assert dates.weekofyear.tolist() == expected
343+
assert [d.weekofyear for d in dates] == expected
344+
337345
def test_nanosecond_field(self):
338346
dti = DatetimeIndex(np.arange(10))
339347

0 commit comments

Comments
 (0)