You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing an empty iterator to DataFrame.from_records() along with nrows=0 results in a DataFrame with no columns, even if the columns argument is provided.
Oddly, the correct result is obtained with an empty iterator and nrows > 0. However, columns are still ignored if the iterator is non-empty and nrows=0.
Expected Behavior
Should return a DataFrame with 0 rows and the columns provided.
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Passing an empty iterator to
DataFrame.from_records()
along withnrows=0
results in aDataFrame
with no columns, even if thecolumns
argument is provided.Oddly, the correct result is obtained with an empty iterator and
nrows > 0
. However, columns are still ignored if the iterator is non-empty andnrows=0
.Expected Behavior
Should return a
DataFrame
with 0 rows and the columns provided.Installed Versions
The text was updated successfully, but these errors were encountered: