Created
September 3, 2014 17:19
-
-
Save spitz-dan-l/01a8e7788ffaeec87fd7 to your computer and use it in GitHub Desktop.
Pandas panel not adding column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as ps | |
np.random.seed(0) | |
index=range(3) | |
columns = list('abc') | |
panel = ps.Panel.from_dict( | |
{'A' : ps.DataFrame(np.random.randn(3, 3), index=index, columns=columns), | |
'B' : ps.DataFrame(np.random.randn(3, 3), index=index, columns=columns), | |
'C' : ps.DataFrame(np.random.randn(3, 3), index=index, columns=columns) | |
}, orient='minor') | |
replace = ps.DataFrame(np.eye(4,4), index=range(4), columns=list('abcd')) | |
panel.loc[:,:,'A'] = replace | |
print(panel.loc[:, :, 'A']) #'d' column not added |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment