File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -316,13 +316,15 @@ def __init__(self, values: pa.Array | pa.ChunkedArray) -> None:
316
316
317
317
@classmethod
318
318
def _from_scalars (cls , scalars , dtype : DtypeObj ) -> Self :
319
+ inferred_dtype = lib .infer_dtype (scalars , skipna = True )
319
320
try :
320
321
pa_array = cls ._from_sequence (scalars , dtype = dtype )
321
- except pa .ArrowNotImplementedError :
322
+ except pa .ArrowNotImplementedError as err :
322
323
# _from_scalars should only raise ValueError or TypeError.
323
- raise ValueError
324
+ raise ValueError from err
324
325
325
- if lib .infer_dtype (scalars , skipna = True ) != lib .infer_dtype (pa_array , skipna = True ):
326
+ same_dtype = lib .infer_dtype (pa_array , skipna = True ) == inferred_dtype
327
+ if not same_dtype :
326
328
raise ValueError
327
329
return pa_array
328
330
You can’t perform that action at this time.
0 commit comments