Let's take the following example:
d = {'Item1' : pandas.DataFrame(numpy.random.randn(4, 3)),
'Item2' : pandas.DataFrame(numpy.random.randn(4, 2))}
p = pandas.Panel(d)
p.clip(0,1)
If I run the script with pandas 0.14.1 on both python 2.7.8 and 3.4.1 I'm getting the following error:
Traceback (most recent call last):
File "Untitled.py", line 11, in <module>
p.clip(0,1)
File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 2684, in clip
result = result.clip_lower(lower)
File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 2722, in clip_lower
return self.where((self >= threshold) | isnull(self), threshold)
File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 934, in f
self._constructor.__name__)
ValueError: Simple arithmetic with Panel can only be done with scalar values
Digging a little bit deeper showed that the following line (the | operator to be precise) raises the error: https://github.com/pydata/pandas/blob/1d65bc89d64c71f8d36f3ca92dd57db2efad7fdb/pandas/core/generic.py#L2796
Comment From: jreback
so IIRC this was a moved method to generic a while back as it makes sense for all pandas objects. But no tests for > 2 ndim. So need to rectify that. Separately the ops DO need to be fixed to handle this ndim case (as you see the |
or a boolean Panel).
pull-requests are welcome!
Comment From: jreback
closing as Panel deprecated