Skip to content

BUG: filling doesn't work well for sparse blocks #6949

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

Closed
immerrr opened this issue Apr 24, 2014 · 1 comment
Closed

BUG: filling doesn't work well for sparse blocks #6949

immerrr opened this issue Apr 24, 2014 · 1 comment
Labels
Bug Sparse Sparse Data Type

Comments

@immerrr
Copy link
Contributor

immerrr commented Apr 24, 2014

In [1]: pd.__version__
Out[1]: '0.13.1'

In [2]: pd.DataFrame({'a': pd.SparseArray([1,2,3, np.nan, np.nan]), 'b': [1,2,3,np.nan,np.nan]})
Out[2]: 
    a   b
0   1   1
1   2   2
2   3   3
3 NaN NaN
4 NaN NaN

[5 rows x 2 columns]

In [3]: _2.reindex(_2.index[1:], fill_value=10.)
Out[3]: 
    a   b
1   2   2
2   3   3
3  10 NaN
4  10 NaN

[4 rows x 2 columns]

Also, this looks weird, I'd expect sparse array to preserve nans:

In [3]: pd.SparseArray([np.nan, np.nan], fill_value=0.0).to_dense()
Out[3]: array([ 0.,  0.])
@jreback jreback added this to the 0.15.0 milestone Apr 24, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@sinhrks
Copy link
Member

sinhrks commented Apr 5, 2016

Dupe of #12797. Closing as #12797 has some discussions.

@sinhrks sinhrks closed this as completed Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Sparse Sparse Data Type
Projects
None yet
Development

No branches or pull requests

3 participants