Created
February 7, 2014 00:15
-
-
Save fnoble/8855189 to your computer and use it in GitHub Desktop.
Pandas Panel problem
This file contains hidden or 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 pandas | |
wp = pandas.Panel(randn(2, 5, 4), items=['Item1', 'Item2'], | |
major_axis=pandas.date_range('1/1/2000', periods=5), | |
minor_axis=['A', 'B', 'C', 'D']) | |
wp2 = pandas.Panel(randn(3, 5, 4), items=['Item1', 'Item2', 'Item3'], | |
major_axis=pandas.date_range('1/1/2000', periods=5), | |
minor_axis=['A', 'B', 'C', 'D']) | |
wp.sub(wp2).ix[:, :, 'A'] | |
# Output: | |
# Item1 Item2 Item3 | |
# 2000-01-01 1.182223 0.385267 -0.370692 | |
# 2000-01-02 -0.358195 -0.040343 0.350876 | |
# 2000-01-03 -0.237364 0.213128 0.313635 | |
# 2000-01-04 -1.093256 0.620667 1.686411 | |
# 2000-01-05 -1.906565 -1.295648 -0.644578 | |
# | |
# Why is column 'Item3' there? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version is 0.12.0