File tree 3 files changed +12
-1
lines changed
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Fixed regressions
22
22
Bug fixes
23
23
~~~~~~~~~
24
24
- 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 `)
25
26
- Bug in :meth: `DataFrame.apply ` where passing ``raw=True `` ignored ``args `` passed to the applied function (:issue: `55753 `)
26
27
- Bug in :meth: `Index.__getitem__ ` returning wrong result for Arrow dtypes and negative stepsize (:issue: `55832 `)
27
28
- 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 @@ -462,7 +462,7 @@ def _box_pa_array(
462
462
463
463
try :
464
464
pa_array = pa .array (value , type = pa_type , from_pandas = True )
465
- except pa .ArrowInvalid :
465
+ except ( pa .ArrowInvalid , pa . ArrowTypeError ) :
466
466
# GH50430: let pyarrow infer type, then cast
467
467
pa_array = pa .array (value , from_pandas = True )
468
468
Original file line number Diff line number Diff line change @@ -3100,3 +3100,13 @@ def test_arrow_floordiv():
3100
3100
expected = pd .Series ([- 2 ], dtype = "int64[pyarrow]" )
3101
3101
result = a // b
3102
3102
tm .assert_series_equal (result , expected )
3103
+
3104
+
3105
+ def test_string_to_datetime_parsing_cast ():
3106
+ # GH 56266
3107
+ string_dates = ["2020-01-01 04:30:00" , "2020-01-02 00:00:00" , "2020-01-03 00:00:00" ]
3108
+ result = pd .Series (string_dates , dtype = "timestamp[ns][pyarrow]" )
3109
+ expected = pd .Series (
3110
+ ArrowExtensionArray (pa .array (pd .to_datetime (string_dates ), from_pandas = True ))
3111
+ )
3112
+ tm .assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments