You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdimportnumpyasnpdata=np.random.randn(5, 100, 5)
panel=pd.Panel(data, items=list("AACDE"))
panel.iloc[0] # ValueError: Wrong number of dimensionsfr=panel.loc["E"]
fr.values.shape# (5, 100, 5) wrong
So this is another contrived example that I got from just running a battery of tests on random objects. Basically having a duplicate item key will bork the Panel.
I'm actually not sure whether Panel is meant to be a collection of uniquely identified DataFrames, or more like a generic 3d container that has convenient semantics for its axes. I think at one point it was the former, but as more things pull from generic it's becoming the later?
The text was updated successfully, but these errors were encountered:
@jreback Also should Panel support non-scalar arith methods like: panel * panel? I hear mention of an arith refactor and wasn't sure if that was included.
@dalejung I take it back, I think you can just remove that test and it should work (but needs some tests)....want to do a PR?
def _arith_method(func, name):
# work only for scalars
def f(self, other):
#if not np.isscalar(other):
# raise ValueError('Simple arithmetic with %s can only be '
# 'done with scalar values' % self._constructor.__name__)
return self._combine(other, func)
f.__name__ = name
return f
then this works
In [20]: p = tm.makePanel()
In [21]: tm.assert_frame_equal(2*p['ItemA'],(p + p.loc[['ItemA']])['ItemA'])
So this is another contrived example that I got from just running a battery of tests on random objects. Basically having a duplicate item key will bork the
Panel
.I'm actually not sure whether Panel is meant to be a collection of uniquely identified DataFrames, or more like a generic 3d container that has convenient semantics for its axes. I think at one point it was the former, but as more things pull from generic it's becoming the later?
The text was updated successfully, but these errors were encountered: