Skip to content

SparseDataFrame.isnull raises an error #8276

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
isofer opened this issue Sep 15, 2014 · 1 comment · Fixed by #13849
Closed

SparseDataFrame.isnull raises an error #8276

isofer opened this issue Sep 15, 2014 · 1 comment · Fixed by #13849
Labels
Enhancement Sparse Sparse Data Type
Milestone

Comments

@isofer
Copy link

isofer commented Sep 15, 2014

pandas version 0.14.0:
SparseDataFrame.isnull method raises an error

>>> import pandas as pd
>>> from numpy.random import rand
>>> a = pd.SparseDataFrame(rand(5,5))
>>> a.isnull()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/generic.py", line 2606, in isnull
    return isnull(self).__finalize__(self)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/common.py", line 129, in isnull
    return _isnull(obj)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/common.py", line 141, in _isnull_new
    return obj._constructor(obj._data.isnull(func=isnull))
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 2179, in isnull
    return self.apply('apply', **kwargs)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 2164, in apply
    applied = getattr(b, f)(**kwargs)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 234, in apply
    result = make_block(values=result, placement=self.mgr_locs,)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 1837, in make_block
    placement=placement)
  File "/Users/isofer/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 74, in __init__
    len(self.values), len(self.mgr_locs)))
ValueError: Wrong number of items passed 5, placement implies 1


>>> a = pd.DataFrame(rand(5,5))
>>> a.isnull()
       0      1      2      3      4
0  False  False  False  False  False
1  False  False  False  False  False
2  False  False  False  False  False
3  False  False  False  False  False
4  False  False  False  False  False
>>>

I was also able to reproduce it also in new env with pandas 0.14.1.
(conda create pandas -n test)

@jreback
Copy link
Contributor

jreback commented Sep 15, 2014

a lot of the sparse methods are not tested / implemented (eg this inherits the implementation which is not exactly right in this case)

would love for an interested person to put some effort into this (and other sparse issues)

@jreback jreback added Sparse Sparse Data Type Enhancement labels Sep 15, 2014
@jreback jreback modified the milestones: 0.15.1, 0.15.0, 0.16 Sep 15, 2014
@jreback jreback modified the milestones: 0.16, 0.15.1 Oct 7, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jreback jreback modified the milestones: 0.19.0, Next Major Release Aug 18, 2016
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.

2 participants