File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -567,16 +567,16 @@ def from_tuples(
567567 return cls .from_arrays (arrays , sortorder = sortorder , names = names )
568568
569569 # Convert to list and normalize
570- tuples_list = list ( tuples )
571- max_length = max ( len ( t ) if isinstance ( t , tuple ) else 1 for t in tuples_list )
572-
573- result_tuples = []
574- for t in tuples_list :
575- if not isinstance ( t , tuple ):
576- t = ( t ,)
577- result_tuples . append ( t + ( np . nan ,) * ( max_length - len ( t )))
578-
579- arrays = list ( lib . to_object_array_tuples ( result_tuples ). T )
570+ tuples_list = [ t if isinstance ( t , tuple ) else ( t ,) for t in tuples ]
571+ if not tuples_list :
572+ arrays = []
573+ else :
574+ max_length = max ( len ( t ) for t in tuples_list )
575+ result_tuples = [
576+ t + ( np . nan ,) * ( max_length - len ( t )) for t in tuples_list
577+ ]
578+ arrays = list ( lib . to_object_array_tuples ( result_tuples ). T )
579+
580580 return cls .from_arrays (arrays , sortorder = sortorder , names = names )
581581
582582 @classmethod
You can’t perform that action at this time.
0 commit comments