Skip to content

SparseDataFrame.shift does not respond to axis #6427

Closed
@gouthambs

Description

@gouthambs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions