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 @@ -1247,6 +1247,7 @@ Indexing
1247
1247
- Bug in :meth: `DataFrame.compare ` does not recognize differences when comparing ``NA `` with value in nullable dtypes (:issue: `48939 `)
1248
1248
- Bug in :meth: `Series.rename ` with :class: `MultiIndex ` losing extension array dtypes (:issue: `21055 `)
1249
1249
- Bug in :meth: `DataFrame.isetitem ` coercing extension array dtypes in :class: `DataFrame ` to object (:issue: `49922 `)
1250
+ - Bug in :meth: `Series.__getitem__ ` returning corrupt object when selecting from an empty pyarrow backed object (:issue: `51734 `)
1250
1251
- Bug in :class: `BusinessHour ` would cause creation of :class: `DatetimeIndex ` to fail when no opening hour was included in the index (:issue: `49835 `)
1251
1252
1252
1253
Missing
Original file line number Diff line number Diff line change 252
252
else :
253
253
FLOAT_PYARROW_DTYPES_STR_REPR = []
254
254
ALL_INT_PYARROW_DTYPES_STR_REPR = []
255
+ ALL_PYARROW_DTYPES = []
255
256
256
257
257
258
EMPTY_STRING_PATTERN = re .compile ("^$" )
Original file line number Diff line number Diff line change @@ -1010,7 +1010,12 @@ def _concat_same_type(
1010
1010
ArrowExtensionArray
1011
1011
"""
1012
1012
chunks = [array for ea in to_concat for array in ea ._data .iterchunks ()]
1013
- arr = pa .chunked_array (chunks )
1013
+ if to_concat [0 ].dtype == "string" :
1014
+ # StringDtype has no attrivute pyarrow_dtype
1015
+ pa_dtype = pa .string ()
1016
+ else :
1017
+ pa_dtype = to_concat [0 ].dtype .pyarrow_dtype
1018
+ arr = pa .chunked_array (chunks , type = pa_dtype )
1014
1019
return cls (arr )
1015
1020
1016
1021
def _accumulate (
Original file line number Diff line number Diff line change @@ -2298,3 +2298,11 @@ def test_dt_tz_localize(unit):
2298
2298
dtype = ArrowDtype (pa .timestamp (unit , "US/Pacific" )),
2299
2299
)
2300
2300
tm .assert_series_equal (result , expected )
2301
+
2302
+
2303
+ def test_concat_empty_arrow_backed_series (dtype ):
2304
+ # GH#51734
2305
+ ser = pd .Series ([], dtype = dtype )
2306
+ expected = ser .copy ()
2307
+ result = pd .concat ([ser [np .array ([], dtype = np .bool_ )]])
2308
+ tm .assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments