Question

I have a pandas panel of investment pricing data to which I want to add two new minor axis columns (portfolio holding and benchmark holding).

The initial panel is:

<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 463 (major) x 8 (minor)
Items: ListedEquity:BHP Billiton:BHP.AX to SavingsAccount:ING Australia Savings Maximiser
Major axis: 2010-01-04 00:00:00 to 2011-10-31 00:00:00
Minor axis: content_type to xrate

which conceptually looks like:

         Investment 1   Investment 2
         c1 c2 c3...    c1 c2 c3...
Date 1
Date 2
...

Is it possible create a matching panel that only has these columns and then somehow merge the two?

Thoughts on possible alternative ways of achieving this?

The documentation on the Panel data structure is pretty bare.

EDIT:

I created the 2nd panel and tried p1.join(p2) but this generates a columns overlap error.

Here's the 2nd panel I would like to append:

<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 463 (major) x 2 (minor)
Items: ListedEquity:BHP Billiton:BHP.AX to SavingsAccount:Comsec Cash Management Account
Major axis: 2010-01-04 00:00:00 to 2011-10-31 00:00:00
Minor axis: benchmark to portfolio
Was it helpful?

Solution

Sorry I missed this question some time ago. Could you have a look at the new concat function in pandas 0.7.0 and see if it meets your needs:

http://pandas.pydata.org/pandas-docs/stable/merging.html#concatenating-objects

I recently spent a great deal of time on the join and concatenation methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top