pandas - Best way to Shift along a Multi Index Time series -


Do I have Detafrem including alternative data I have for each element is a current date and the expiration date. I have a two-level multi index that looks like:

  Symbol Exchange Adjusted Share Close Price \ expiration date 01/31/90 02/17/90 SPX CBOE 32 9.08 02/17 / 90 Spiaks en: CBOE 32 9:08 2/17/90 Spiaks en: CBOE 32 9:08 2/17/90 Spiaks en: CBOE 32 9:08 2/17/90 Spiaks en: CBOE 32 9:08 ...... ...... ...... exchange-adjusted closing share price \ expiration date 14/02/14 12/16/16 Spiaks en: CBOE 1838.63 12.16.16 Spiaks en: CBOE 1838.63 12.16.16 Spiaks en: CBOE 1838.63 12.16.16 Spiaks Number BOE 1838.63 16.12.16 Spiaks en: CBOE 1838.63  

There are other columns, but for example, they are irrelevant. What I am trying to do, and I can not just be fuzzy on transfer documents, to move all the data down from the first level index to or above, then transfer all the data from the next date index to the previous date index. So if there were no other dates between the examples, then I would like a data frame that looks like:

  symbol exchange adjusted share closed price \ expiration date 01/31/90 12/16 / 16 Spiaks en: CBOE 1838.63 12.16.16 Spiaks en: CBOE 1838.63 16.12.16 Spiaks en: CBOE 1838.63 16.12.16 Spiaks en: CBOE 1838.63 16.12.16 Spiaks en: CBOE 1838.63 ...... ........ ..... Symbol Exchange Adjusted Share Close Price \ expiration date of 02/14/14 This nan data will be because its coming Khari Set  

Does this make any sense? This idea is to change all the data in a period to calculate the change in prices.

Thanks in advance for any help I am going to try some other methods in the meantime.


Comments