Index dtype changes when assigning column from index
See original GitHub issue- Creating a new ddf column from the ddf’s existing index erroneously changes the dtype of the index
- Impact: causes downstream ddf operations to fail or behave in unintended ways, e.g. dd.concat
>>> ddf = dd.from_pandas(pd.DataFrame(dict(i=['a','b'], a=[1,2])), npartitions=1)
>>> ddf = ddf.set_index('i)
>>> ddf.index
Dask Index Structure:
npartitions=1
a object
b ...
Name: i, dtype: object
Dask Name: sort_index, 4 tasks
>>> ddf.assign(b=ddf.index).index
Dask Index Structure:
npartitions=1
a int64
b ...
dtype: int64
Dask Name: assign, 6 tasks
Versions
$ python --version
Python 3.6.0
$ cat requirements.txt | egrep 'dask/dask' | grep -v '^#'
git+https://github.com/dask/dask.git@00ed56e
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Assign existing column to the DataFrame index with set_index()
By using set_index() , you can assign an existing column of pandas.DataFrame to index (row label). Setting unique names for index makes it...
Read more >pandas.DataFrame.set_index — pandas 1.5.2 documentation
Set the DataFrame index (row labels) using one or more existing columns or arrays (of the correct length). ... Change to same indices...
Read more >Change Pandas index datatype on MultiIndex - Stack Overflow
I have a Pandas dataframe with two indexes
Read more >Pandas Set Index to Column in DataFrame
One simple way to set an index to a column is by assigning an index as a new column to pandas DataFrame. DataFrame.index...
Read more >Python | Pandas Index.astype() - GeeksforGeeks
Example #1: Use Index.astype() function to change the data type of index from float to integer type.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is fixed by #4695:
@jcrist Thanks!