@@ -499,9 +499,7 @@ def dataclasses_to_dicts(data):
499
499
# Conversion of Inputs to Arrays
500
500
501
501
502
- def to_arrays (
503
- data , columns , coerce_float : bool = False , dtype : Optional [DtypeObj ] = None
504
- ):
502
+ def to_arrays (data , columns , dtype : Optional [DtypeObj ] = None ):
505
503
"""
506
504
Return list of arrays, columns.
507
505
"""
@@ -525,15 +523,11 @@ def to_arrays(
525
523
return [[]] * len (columns ), columns
526
524
return [], [] # columns if columns is not None else []
527
525
if isinstance (data [0 ], (list , tuple )):
528
- return _list_to_arrays (data , columns , coerce_float = coerce_float , dtype = dtype )
526
+ return _list_to_arrays (data , columns , dtype = dtype )
529
527
elif isinstance (data [0 ], abc .Mapping ):
530
- return _list_of_dict_to_arrays (
531
- data , columns , coerce_float = coerce_float , dtype = dtype
532
- )
528
+ return _list_of_dict_to_arrays (data , columns , dtype = dtype )
533
529
elif isinstance (data [0 ], ABCSeries ):
534
- return _list_of_series_to_arrays (
535
- data , columns , coerce_float = coerce_float , dtype = dtype
536
- )
530
+ return _list_of_series_to_arrays (data , columns , dtype = dtype )
537
531
elif isinstance (data [0 ], Categorical ):
538
532
if columns is None :
539
533
columns = ibase .default_index (len (data ))
@@ -549,13 +543,12 @@ def to_arrays(
549
543
else :
550
544
# last ditch effort
551
545
data = [tuple (x ) for x in data ]
552
- return _list_to_arrays (data , columns , coerce_float = coerce_float , dtype = dtype )
546
+ return _list_to_arrays (data , columns , dtype = dtype )
553
547
554
548
555
549
def _list_to_arrays (
556
550
data : List [Scalar ],
557
551
columns : Union [Index , List ],
558
- coerce_float : bool = False ,
559
552
dtype : Optional [DtypeObj ] = None ,
560
553
) -> Tuple [List [Scalar ], Union [Index , List [Axis ]]]:
561
554
if len (data ) > 0 and isinstance (data [0 ], tuple ):
@@ -566,7 +559,7 @@ def _list_to_arrays(
566
559
# gh-26429 do not raise user-facing AssertionError
567
560
try :
568
561
columns = _validate_or_indexify_columns (content , columns )
569
- result = _convert_object_array (content , dtype = dtype , coerce_float = coerce_float )
562
+ result = _convert_object_array (content , dtype = dtype )
570
563
except AssertionError as e :
571
564
raise ValueError (e ) from e
572
565
return result , columns
@@ -575,7 +568,6 @@ def _list_to_arrays(
575
568
def _list_of_series_to_arrays (
576
569
data : List ,
577
570
columns : Union [Index , List ],
578
- coerce_float : bool = False ,
579
571
dtype : Optional [DtypeObj ] = None ,
580
572
) -> Tuple [List [Scalar ], Union [Index , List [Axis ]]]:
581
573
if columns is None :
@@ -604,7 +596,7 @@ def _list_of_series_to_arrays(
604
596
if values .dtype == np .object_ :
605
597
content = list (values .T )
606
598
columns = _validate_or_indexify_columns (content , columns )
607
- content = _convert_object_array (content , dtype = dtype , coerce_float = coerce_float )
599
+ content = _convert_object_array (content , dtype = dtype )
608
600
return content , columns
609
601
else :
610
602
return values .T , columns
@@ -613,7 +605,6 @@ def _list_of_series_to_arrays(
613
605
def _list_of_dict_to_arrays (
614
606
data : List [Dict ],
615
607
columns : Union [Index , List ],
616
- coerce_float : bool = False ,
617
608
dtype : Optional [DtypeObj ] = None ,
618
609
) -> Tuple [List [Scalar ], Union [Index , List [Axis ]]]:
619
610
"""
@@ -629,7 +620,6 @@ def _list_of_dict_to_arrays(
629
620
data : iterable
630
621
collection of records (OrderedDict, dict)
631
622
columns: iterables or None
632
- coerce_float : bool
633
623
dtype : np.dtype
634
624
635
625
Returns
@@ -648,7 +638,7 @@ def _list_of_dict_to_arrays(
648
638
649
639
content = list (lib .dicts_to_array (data , list (columns )).T )
650
640
columns = _validate_or_indexify_columns (content , columns )
651
- content = _convert_object_array (content , dtype = dtype , coerce_float = coerce_float )
641
+ content = _convert_object_array (content , dtype = dtype )
652
642
return content , columns
653
643
654
644
@@ -711,15 +701,14 @@ def _validate_or_indexify_columns(
711
701
712
702
713
703
def _convert_object_array (
714
- content : List [Scalar ], coerce_float : bool = False , dtype : Optional [DtypeObj ] = None
704
+ content : List [Scalar ], dtype : Optional [DtypeObj ] = None
715
705
) -> List [Scalar ]:
716
706
"""
717
707
Internal function ot convert object array.
718
708
719
709
Parameters
720
710
----------
721
711
content: list of processed data records
722
- coerce_float: bool, to coerce floats or not, default is False
723
712
dtype: np.dtype, default is None
724
713
725
714
Returns
@@ -729,7 +718,7 @@ def _convert_object_array(
729
718
# provide soft conversion of object dtypes
730
719
def convert (arr ):
731
720
if dtype != np .dtype ("O" ):
732
- arr = lib .maybe_convert_objects (arr , try_float = coerce_float )
721
+ arr = lib .maybe_convert_objects (arr )
733
722
arr = maybe_cast_to_datetime (arr , dtype )
734
723
return arr
735
724
0 commit comments