-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
dataframegood first issueClearly described and easy to accomplish. Good for beginners to the project.Clearly described and easy to accomplish. Good for beginners to the project.
Description
If meta's index name is not explicitly set dask sets the index name to None. Wouldn't it be preferable to use the available index name of ddf?
In [1]: import pandas as pd
...: import dask.dataframe as dd
...: import numpy as np
...:
In [2]: df = pd.DataFrame({
...: 'a': np.arange(20)**2,
...: 'ts': pd.date_range('01-01-2000', periods=20).map(str)
...: }, index=pd.Index(np.arange(20), name='id')
...: )
...:
In [3]: ddf = dd.from_pandas(df, npartitions=4)
In [4]: ddf.index.name
Out[4]: 'id'
In [5]: ddf2 = ddf.assign(ts_parsed=ddf.ts.map_partitions(pd.to_datetime, meta='datetime64[ns]'))
In [6]: print(ddf2.index.name)
Out[6]: None
.....
In [8]: meta = pd.Series([], dtype='datetime64[ns]')
...: meta.index.name = 'id'
In [9]: ddf2 = ddf.assign(ts_parsed=ddf.ts.map_partitions(pd.to_datetime, meta=meta))
In [10]: print(ddf2.index.name)
id
Metadata
Metadata
Assignees
Labels
dataframegood first issueClearly described and easy to accomplish. Good for beginners to the project.Clearly described and easy to accomplish. Good for beginners to the project.