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
{{ message }}
Repository navigation
inconsistency in dataframe: no multiindex from pandas, but allowed from parquet #8323
What happened:
Unexpected difference in handling the same structure from pandas or from parquet. I'm not completely sure if this is a bug or just an incomplete feature. But that multiindex loading is allowed from parquet is a surprise.
What you expected to happen:
If MultiIndex can be supported from parquet, then it should be supported from pandas too(?)
Minimal Complete Verifiable Example:
importnumpyasnpimportpandasaspdimportfastparquetnp.random.seed(1)
df=pd.DataFrame(np.random.randint(0, 10, size=(10, 4)), columns=['a', 'b', 'c', 'd']).set_index(['a', 'b']).sort_index()
importdask.dataframe# Errors with: NotImplementedError: Dask does not support MultiIndex Dataframes.dask.dataframe.from_pandas(df)
# This succeeds and reads it with the MultiIndexdf.to_parquet("multi.pq", engine='fastparquet')
dask.dataframe.read_parquet("multi.pq").compute()
Yeah this is not a huge surprise. Dask doesn't really have MultiIndex support, but you can sometimes get MultiIndex partition within dask dataframes. There are limitations to what you can do with these dataframes because they will never be able to understand the range of each partition (dask calls these divisions). That is why from_pandas fails, that method always tries to figure out the divisions.
If you are interested in real MultiIndex support in Dask, you can follow this PR: #8153. If you have ideas or suggestions of how things should work, please feel free to comment!
Activity
jsignell commentedon Nov 5, 2021
Yeah this is not a huge surprise. Dask doesn't really have MultiIndex support, but you can sometimes get MultiIndex partition within dask dataframes. There are limitations to what you can do with these dataframes because they will never be able to understand the range of each partition (dask calls these
divisions). That is whyfrom_pandasfails, that method always tries to figure out the divisions.If you are interested in real MultiIndex support in Dask, you can follow this PR: #8153. If you have ideas or suggestions of how things should work, please feel free to comment!
pavithraes commentedon Mar 1, 2022
@jsignell Thanks for looking into this!