Now I understand that the PanelND experimental objects will meet my needs brilliantly, except that I cannot save them:
p4d = pd.Panel4D(np.random.randn(2, 2, 5, 4), labels=['Label1','Label2'], items=['Item1', 'Item2'], major_axis=pd.date_range('1/1/2000', periods=5), minor_axis=['A', 'B', 'C', 'D']) p4d.save('p4d') ... PicklingError: Can't pickle <class 'pandas.core.panelnd.Panel4D'>: attribute lookup pandas.core.panelnd.Panel4D failed
And if I try to write it to the HDFStore, I get:
TypeError: cannot properly create the storer for: [_STORER_MAP] [group->/p4d (Group) u'',value-><class 'pandas.core.panelnd.Panel4D'>,table->None,append->False,kwargs->{}]
Besides saving individual DataFrames and stitching them together, how can I save higher-size objects?
Edit: I see that store.append() works for Panel4D, but save() does not work, as well as store.append() for the Panel5D example. I am really above 4D, so the problem still persists.
Edit: more details:
I am trying to create an arbitrary dimensional panel, inside nested loops for measurements, and then, in order to be able to cut this data again arbitrarily, so I can process it (compare, build, optimize)
In the (rough) code:
for a in range(1,10): panel4ddict = {} for b in range(101, 150): paneldict = {} for c in range(500, 501): df = MakeDataFrame(a, b, c) # returns processed df paneldict[c] = df p3d = Panel(paneldict) panel4ddict[b] = p3d p4d = Panel4D(panel4ddict) panel5ddict[a] = p4d panel5d = Panel5D(panel5ddict) sliced = panel5d[:,3,5:6] # and then do some plotting of my sliced DF