-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
In PyArrow's dataset class, if I give it multiple parquet files in a list and these parquet files have potentially different columns, it will always take the schema from the first parquet file in the list, thus ignoring columns that the first file doesn't have. Getting all columns within the files into the same dataset implies passing a manual schema or constructing one by iterating over the files and checking for their columns.
Would be nicer if PyArrow's dataset class could have an option to automatically take all columns within the files from which it is constructed.
import numpy as np, pandas as pd
df1 = pd.DataFrame({
"col1" : np.arange(10),
"col2" : np.random.choice(["a", "b"], size=10)
})
df2 = pd.DataFrame({
"col1" : np.arange(10, 20),
"col3" : np.random.random(size=10)
})
df1.to_parquet("df1.parquet")
df2.to_parquet("df2.parquet")import pyarrow.dataset as pds
ff = ["df1.parquet", "df2.parquet"]### Code below will generate a DF with col1 and col2, but no col3pds.dataset(ff, format="parquet").to_table().to_pandas()
Reporter: David Cortes
Related issues:
Note: This issue was originally created as ARROW-9455. Please see the migration documentation for further details.