Fix map(series) for unsorted base series index#5459
Fix map(series) for unsorted base series index#5459TomAugspurger merged 5 commits intodask:masterfrom bluecoconut:mapseries-bugfix
Conversation
dask/dataframe/core.py
Outdated
| def mapseries_combine(index, concat_result): | ||
| final_series = concat_result.sort_index() | ||
| final_series.index = index | ||
| final_series = pd.Series(index, index=index).map(final_series) |
There was a problem hiding this comment.
We've been trying to avoid using pd.Series explicitly, in order to improve support for other dataframe libraries that are similar enough to pandas (notably RAPIDS cudf). Can you think of a way that would produce a Series object that don't explicitly use the pandas module?
There was a problem hiding this comment.
I'll work on this a bit and see what I can do. First few attempts somehow ended up passing tests, but functionally gave wrong results, so I'm gonna update some tests too to make this cleaner.
There was a problem hiding this comment.
Actually, just found that index.to_series() is nearly identical to pd.Series(index, index=index), so just use this to_series() method and everything works!
|
Thanks @bluecoconut. |
Found a bug where tests were not actually catching this, fixes #5458
black dask/flake8 dask