SparseDataFrame.isnull raises an error · Issue #8276 · pandas-dev/pandas (original) (raw)
>>> 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)