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 @@ -311,13 +311,15 @@ def __init__(self, values: pa.Array | pa.ChunkedArray) -> None:
311311
312312 @classmethod
313313 def _from_scalars (cls , scalars , dtype : DtypeObj ) -> Self :
314+ inferred_dtype = lib .infer_dtype (scalars , skipna = True )
314315 try :
315316 pa_array = cls ._from_sequence (scalars , dtype = dtype )
316- except pa .ArrowNotImplementedError :
317+ except pa .ArrowNotImplementedError as err :
317318 # _from_scalars should only raise ValueError or TypeError.
318- raise ValueError
319+ raise ValueError from err
319320
320- if lib .infer_dtype (scalars , skipna = True ) != lib .infer_dtype (pa_array , skipna = True ):
321+ same_dtype = lib .infer_dtype (pa_array , skipna = True ) == inferred_dtype
322+ if not same_dtype :
321323 raise ValueError
322324 return pa_array
323325
You can’t perform that action at this time.
0 commit comments