wesm/pandas — Issue #359: creating Panel from dict of DataFrames loses dtypes
Author: CRP
Created: 2011-11-11 14:13:36+00:00
State: open

in the example below, "a" is a mixed type dataframe. Once included in the Panel, all columns become of type object:

In [249]: a=DataFrame(randn(30,3),columns=('a','b','c'))

In [250]: b=DataFrame(randn(30,3),columns=('a','b','c'))

In [251]: a['b']=a['b'].astype(object)

In [252]: a.dtypes
Out[252]:
a float64
b object
c float64

In [253]: b.dtypes
Out[253]:
a float64
b float64
c float64

In [254]: Panel({'1':a,'2':b})['1'].dtypes
Out[254]:
a object
b object
c object

In [255]: Panel({'1':a,'2':b})['2'].dtypes
Out[255]:
a float64
b float64
c float64