Skip to content

Commit 04871d4

Browse files
committed
simplify
1 parent a7f5fd0 commit 04871d4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pandas/core/series.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
validate_all_hashable,
7878
)
7979
from pandas.core.dtypes.dtypes import (
80-
ArrowDtype,
8180
CategoricalDtype,
8281
ExtensionDtype,
8382
SparseDtype,
@@ -586,13 +585,9 @@ def __arrow_c_stream__(self, requested_schema=None):
586585
if requested_schema is not None
587586
else None
588587
)
589-
if isinstance(self.dtype, ArrowDtype):
590-
# fastpath!
591-
ca = self.values._pa_array
592-
if type is not None:
593-
ca = ca.cast(type)
594-
else:
595-
ca = pa.chunked_array([pa.Array.from_pandas(self, type=type)])
588+
ca = pa.array(self, type=type)
589+
if not isinstance(ca, pa.ChunkedArray):
590+
ca = pa.chunked_array([ca])
596591
return ca.__arrow_c_stream__()
597592

598593
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)