Reputation: 881
I am creating a Panel out of two DataFrames as such:
import pandas as pd
d1 = pd.DataFrame(index=pd.MultiIndex.from_product(iterables=[['a','b'],[1,'2','3'],[4]]), data=list(range(6)))
print('d1 before panel:')
print(d1)
d2 = pd.DataFrame(index=pd.MultiIndex.from_product(iterables=[['a'],['1','2'],[1, '2']]), data=list(range(4)))
print('\nd2 before panel:')
print(d2)
print('=================')
p = pd.Panel({'d1': d1, 'd2': d2})
print('\npanel d1:')
print(p['d1'])
print('\npanel d2:')
print(p['d2'])
Note that I mixed index types (ints and strings).
The Panel I get after this initialization shows d1 completely NaN, with some indices duplicated ('a'-1-4 and 'a'-'2'-4).
It seems that something has gone horribly wrong. Are there any documented no-no's that I'm breaching?
Upvotes: 1
Views: 514
Reputation: 881
I solved this problem by updating Pandas. I was using 0.13, and now I have 0.15.2.
Upvotes: 1