Using a Python dictionary of DataFrame objects

A panel consists of several DataFrames. To create a panel, let's define two DataFrames:

USData = pd.DataFrame(np.array([[249.62 , 8900],
[ 282.16,12680],
[309.35,14940]]),
columns=['Population(M)','GDP($B)'],
index=[1990,2000,2010])
ChinaData = pd.DataFrame(np.array([[1133.68, 390.28],
[ 1266.83,1198.48],
[1339.72, 6988.47]]),
columns=['Population(M)','GDP($B)'],
index=[1990,2000,2010])

Now, a dictionary of these DataFrames can be created:

In [73]: US_ChinaData={'US' : USData, 'China': ChinaData}
In [74]: pd.Panel(US_ChinaData)
Out[74]:
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 3 (major_axis) x 2 (minor_axis)
Items axis: US to China
Major_axis axis: 1990 to 2010
Minor_axis axis: Population(M) to GDP($B)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.46.131