@@ -2648,31 +2648,25 @@ def to_dataframe(
2648
2648
if pyarrow .types .is_timestamp (col .type )
2649
2649
)
2650
2650
2651
- if len (record_batch ) > 0 :
2652
- df = record_batch .to_pandas (
2651
+ df = record_batch .to_pandas (
2652
+ date_as_object = date_as_object ,
2653
+ timestamp_as_object = timestamp_as_object ,
2654
+ integer_object_nulls = True ,
2655
+ types_mapper = _pandas_helpers .default_types_mapper (
2653
2656
date_as_object = date_as_object ,
2654
- timestamp_as_object = timestamp_as_object ,
2655
- integer_object_nulls = True ,
2656
- types_mapper = _pandas_helpers .default_types_mapper (
2657
- date_as_object = date_as_object ,
2658
- bool_dtype = bool_dtype ,
2659
- int_dtype = int_dtype ,
2660
- float_dtype = float_dtype ,
2661
- string_dtype = string_dtype ,
2662
- date_dtype = date_dtype ,
2663
- datetime_dtype = datetime_dtype ,
2664
- time_dtype = time_dtype ,
2665
- timestamp_dtype = timestamp_dtype ,
2666
- range_date_dtype = range_date_dtype ,
2667
- range_datetime_dtype = range_datetime_dtype ,
2668
- range_timestamp_dtype = range_timestamp_dtype ,
2669
- ),
2670
- )
2671
- else :
2672
- # Avoid "ValueError: need at least one array to concatenate" on
2673
- # older versions of pandas when converting empty RecordBatch to
2674
- # DataFrame. See: https://github.com/pandas-dev/pandas/issues/41241
2675
- df = pandas .DataFrame ([], columns = record_batch .schema .names )
2657
+ bool_dtype = bool_dtype ,
2658
+ int_dtype = int_dtype ,
2659
+ float_dtype = float_dtype ,
2660
+ string_dtype = string_dtype ,
2661
+ date_dtype = date_dtype ,
2662
+ datetime_dtype = datetime_dtype ,
2663
+ time_dtype = time_dtype ,
2664
+ timestamp_dtype = timestamp_dtype ,
2665
+ range_date_dtype = range_date_dtype ,
2666
+ range_datetime_dtype = range_datetime_dtype ,
2667
+ range_timestamp_dtype = range_timestamp_dtype ,
2668
+ ),
2669
+ )
2676
2670
2677
2671
for column in dtypes :
2678
2672
df [column ] = pandas .Series (df [column ], dtype = dtypes [column ], copy = False )
0 commit comments