SparseDataFrame.isnull raises an error #8276

Closed
isofer opened this Issue Sep 15, 2014 · 1 comment

Comments

Projects
None yet
2 participants

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)

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 modified the milestone: 0.15.1, 0.15.0, 0.16 Sep 15, 2014

@jreback jreback modified the milestone: 0.16, 0.15.1 Oct 7, 2014

@jreback jreback modified the milestone: 0.16.0, Next Major Release Mar 6, 2015

@jreback jreback modified the milestone: 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