File tree 4 files changed +16
-1
lines changed
4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1248,6 +1248,7 @@ Indexing
1248
1248
- Bug in :meth: `DataFrame.compare ` does not recognize differences when comparing ``NA `` with value in nullable dtypes (:issue: `48939 `)
1249
1249
- Bug in :meth: `Series.rename ` with :class: `MultiIndex ` losing extension array dtypes (:issue: `21055 `)
1250
1250
- Bug in :meth: `DataFrame.isetitem ` coercing extension array dtypes in :class: `DataFrame ` to object (:issue: `49922 `)
1251
+ - Bug in :meth: `Series.__getitem__ ` returning corrupt object when selecting from an empty pyarrow backed object (:issue: `51734 `)
1251
1252
- Bug in :class: `BusinessHour ` would cause creation of :class: `DatetimeIndex ` to fail when no opening hour was included in the index (:issue: `49835 `)
1252
1253
1253
1254
Missing
Original file line number Diff line number Diff line change 253
253
else :
254
254
FLOAT_PYARROW_DTYPES_STR_REPR = []
255
255
ALL_INT_PYARROW_DTYPES_STR_REPR = []
256
+ ALL_PYARROW_DTYPES = []
256
257
257
258
258
259
EMPTY_STRING_PATTERN = re .compile ("^$" )
Original file line number Diff line number Diff line change @@ -1026,7 +1026,12 @@ def _concat_same_type(
1026
1026
ArrowExtensionArray
1027
1027
"""
1028
1028
chunks = [array for ea in to_concat for array in ea ._data .iterchunks ()]
1029
- arr = pa .chunked_array (chunks )
1029
+ if to_concat [0 ].dtype == "string" :
1030
+ # StringDtype has no attrivute pyarrow_dtype
1031
+ pa_dtype = pa .string ()
1032
+ else :
1033
+ pa_dtype = to_concat [0 ].dtype .pyarrow_dtype
1034
+ arr = pa .chunked_array (chunks , type = pa_dtype )
1030
1035
return cls (arr )
1031
1036
1032
1037
def _accumulate (
Original file line number Diff line number Diff line change @@ -2329,3 +2329,11 @@ def test_from_sequence_of_strings_boolean():
2329
2329
strings = ["True" , "foo" ]
2330
2330
with pytest .raises (pa .ArrowInvalid , match = "Failed to parse" ):
2331
2331
ArrowExtensionArray ._from_sequence_of_strings (strings , dtype = pa .bool_ ())
2332
+
2333
+
2334
+ def test_concat_empty_arrow_backed_series (dtype ):
2335
+ # GH#51734
2336
+ ser = pd .Series ([], dtype = dtype )
2337
+ expected = ser .copy ()
2338
+ result = pd .concat ([ser [np .array ([], dtype = np .bool_ )]])
2339
+ tm .assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments