We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
>>> s = pd.Series([1, 2], index=pd.MultiIndex.from_tuples([(0, 0), (1, 2)])) >>> s 0 0 1 1 2 2 dtype: int64 >>> s.unstack() 0 2 0 1.0 NaN 1 NaN 2.0 >>> s.to_sparse() 0 0 1 1 2 2 dtype: int64 BlockIndex Block locations: array([0], dtype=int32) Block lengths: array([2], dtype=int32 >>> s.to_sparse().unstack() --------------------------------------------------------------------------- TypeError: expected dimension <= 1 data
Unstacking a SparseSeries — i.e. one with a two-level index that should neatly expand into a SparseDataFrame — doesn't work, errors.
>>> s.to_sparse().unstack() 0 2 0 1.0 NaN 1 NaN 2.0 >>> s.to_sparse().unstack().__class__ pandas.core.sparse.frame.SparseDataFrame
pd.show_versions()
The text was updated successfully, but these errors were encountered:
hmm thought we had an issue for this. but yes this should work.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Code Sample, a copy-pastable example if possible
Problem description
Unstacking a SparseSeries — i.e. one with a two-level index that should neatly expand into a SparseDataFrame — doesn't work, errors.
Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: