File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Fixed regressions
2222Bug fixes
2323~~~~~~~~~
2424- Bug in :class: `Series ` constructor raising DeprecationWarning when ``index `` is a list of :class: `Series ` (:issue: `55228 `)
25+ - Bug in :class: `Series ` when trying to cast date-like string inputs to :class: `ArrowDtype ` of ``pyarrow.timestamp `` (:issue: `56266 `)
2526- Bug in :meth: `DataFrame.apply ` where passing ``raw=True `` ignored ``args `` passed to the applied function (:issue: `55753 `)
2627- Bug in :meth: `Index.__getitem__ ` returning wrong result for Arrow dtypes and negative stepsize (:issue: `55832 `)
2728- Fixed bug in :func: `to_numeric ` converting to extension dtype for ``string[pyarrow_numpy] `` dtype (:issue: `56179 `)
Original file line number Diff line number Diff line change @@ -463,7 +463,7 @@ def _box_pa_array(
463463
464464 try :
465465 pa_array = pa .array (value , type = pa_type , from_pandas = True )
466- except pa .ArrowInvalid :
466+ except ( pa .ArrowInvalid , pa . ArrowTypeError ) :
467467 # GH50430: let pyarrow infer type, then cast
468468 pa_array = pa .array (value , from_pandas = True )
469469
Original file line number Diff line number Diff line change @@ -3109,3 +3109,13 @@ def test_arrow_floordiv():
31093109 expected = pd .Series ([- 2 ], dtype = "int64[pyarrow]" )
31103110 result = a // b
31113111 tm .assert_series_equal (result , expected )
3112+
3113+
3114+ def test_string_to_datetime_parsing_cast ():
3115+ # GH 56266
3116+ string_dates = ["2020-01-01 04:30:00" , "2020-01-02 00:00:00" , "2020-01-03 00:00:00" ]
3117+ result = pd .Series (string_dates , dtype = "timestamp[ns][pyarrow]" )
3118+ expected = pd .Series (
3119+ ArrowExtensionArray (pa .array (pd .to_datetime (string_dates ), from_pandas = True ))
3120+ )
3121+ tm .assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments