Skip to content
New issue

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

SparseDataFrame.shift does not respond to axis #6427

Closed
gouthambs opened this issue Feb 21, 2014 · 4 comments · Fixed by #28425
Closed

SparseDataFrame.shift does not respond to axis #6427

gouthambs opened this issue Feb 21, 2014 · 4 comments · Fixed by #28425
Labels
Enhancement Sparse Sparse Data Type

Comments

@gouthambs
Copy link
Contributor

The shift method in SparseDataFrame does not respond to axis correctly.

>>> import pandas as pd
>>> import numpy as np
>>> df = pd.SparseDataFrame(np.random.rand(10,5))
>>> df.shift(1)
          0         1         2         3         4
0       NaN       NaN       NaN       NaN       NaN
1  0.015673  0.456047  0.451249  0.297851  0.178720
2  0.393355  0.594275  0.496614  0.936675  0.311961
3  0.255445  0.141111  0.750324  0.994727  0.965763
4  0.473577  0.644481  0.584495  0.796462  0.689525
5  0.744432  0.918232  0.715706  0.672892  0.598817
6  0.732707  0.110259  0.756422  0.534970  0.449421
7  0.340564  0.907769  0.543032  0.214241  0.564122
8  0.291026  0.616647  0.102853  0.940241  0.693239
9  0.445545  0.760656  0.035569  0.398808  0.050392

[10 rows x 5 columns]
>>> df.shift(1,axis=1)
          0         1         2         3         4
0       NaN       NaN       NaN       NaN       NaN
1  0.015673  0.456047  0.451249  0.297851  0.178720
2  0.393355  0.594275  0.496614  0.936675  0.311961
3  0.255445  0.141111  0.750324  0.994727  0.965763
4  0.473577  0.644481  0.584495  0.796462  0.689525
5  0.744432  0.918232  0.715706  0.672892  0.598817
6  0.732707  0.110259  0.756422  0.534970  0.449421
7  0.340564  0.907769  0.543032  0.214241  0.564122
8  0.291026  0.616647  0.102853  0.940241  0.693239
9  0.445545  0.760656  0.035569  0.398808  0.050392

[10 rows x 5 columns]
>>>

Using Pandas version 0.13.1

@jreback
Copy link
Contributor

jreback commented Feb 21, 2014

not implemented (its pretty non-trivial actually).

@jreback jreback added this to the 0.15.0 milestone Feb 21, 2014
@gouthambs
Copy link
Contributor Author

I can take a stab at it. I just wanted a formal issue to track. Didn't want to mix up with the quick shift issue (#5609).

@jreback
Copy link
Contributor

jreback commented Feb 21, 2014

go for it!

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@datapythonista datapythonista modified the milestones: Contributions Welcome, Someday Jul 8, 2018
@TomAugspurger
Copy link
Contributor

This is essentially a duplicate of #26929 once the sparse subclasses are removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants