File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ Conversion
150150^^^^^^^^^^
151151- Bug in constructing :class: `Series ` with ``int64 `` dtype from a string list raising instead of casting (:issue: `44923 `)
152152- Bug in :meth: `DataFrame.eval ` incorrectly raising an ``AttributeError `` when there are negative values in function call (:issue: `46471 `)
153+ - Bug where any :class: `ExtensionDtype ` subclass with ``kind="M" `` would be interpreted as a timezone type (:issue: `34986 `)
153154-
154155
155156Strings
Original file line number Diff line number Diff line change @@ -382,9 +382,10 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool:
382382 >>> is_datetime64tz_dtype(s)
383383 True
384384 """
385- if isinstance (arr_or_dtype , ExtensionDtype ):
385+ if isinstance (arr_or_dtype , DatetimeTZDtype ):
386386 # GH#33400 fastpath for dtype object
387- return arr_or_dtype .kind == "M"
387+ # GH 34986
388+ return True
388389
389390 if arr_or_dtype is None :
390391 return False
Original file line number Diff line number Diff line change 1313 CategoricalDtype ,
1414 CategoricalDtypeType ,
1515 DatetimeTZDtype ,
16+ ExtensionDtype ,
1617 IntervalDtype ,
1718 PeriodDtype ,
1819)
@@ -239,6 +240,18 @@ def test_is_datetime64tz_dtype():
239240 assert com .is_datetime64tz_dtype (pd .DatetimeIndex (["2000" ], tz = "US/Eastern" ))
240241
241242
243+ def test_custom_ea_kind_M_not_datetime64tz ():
244+ # GH 34986
245+ class NotTZDtype (ExtensionDtype ):
246+ @property
247+ def kind (self ) -> str :
248+ return "M"
249+
250+ not_tz_dtype = NotTZDtype ()
251+ assert not com .is_datetime64tz_dtype (not_tz_dtype )
252+ assert not com .needs_i8_conversion (not_tz_dtype )
253+
254+
242255def test_is_timedelta64_dtype ():
243256 assert not com .is_timedelta64_dtype (object )
244257 assert not com .is_timedelta64_dtype (None )
You can’t perform that action at this time.
0 commit comments