I'm not sure this is a bug, but it bit me recently.
I can fill-in an empty DataFrame
with a Series
:
In [1]: import pandas as pd
In [2]: d = pd.DataFrame()
In [3]: d[0] = pd.Series([1,2,3])
In [4]: d
Out[4]:
0
0 1
1 2
2 3
However, I cannot do the same for a Panel
, even though it fails silently:
In [5]: p = pd.Panel()
In [6]: p[0] = d
In [7]: p
Out[7]:
<class 'pandas.core.panel.Panel'>
Dimensions: 1 (items) x 0 (major_axis) x 0 (minor_axis)
Items axis: 0 to 0
Major_axis axis: None
Minor_axis axis: None
In [8]: p.values
Out[8]: array([], shape=(1, 0, 0), dtype=float64)
I did not find a way to fill-in the empty panel once created empty.
Comment From: Garrett-R
Nice catch and bug report. Definitely looks like a bug to me.
Comment From: jreback
closing as Panels are deprecated