Skip to content

Commit d86cdb0

Browse files
authored
PERF: ArrowExtensionArray._from_sequence (#52256)
1 parent ac993e7 commit d86cdb0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, copy: bool = Fal
251251
except pa.ArrowInvalid:
252252
# GH50430: let pyarrow infer type, then cast
253253
scalars = pa.array(scalars, from_pandas=True)
254-
if pa_dtype:
254+
if pa_dtype and scalars.type != pa_dtype:
255255
scalars = scalars.cast(pa_dtype)
256256
return cls(scalars)
257257

0 commit comments

Comments
 (0)