0

I have a dataframe, "df_ytm", which is indexed by time series and has a header which is a list of bonds ("UKT 1.75 7 19","UKT 3.75 9 19" etc.), the data contains values for the bond on each day.

I have also created a dataframe of custom securities in "df_fly" that has custom names and columns for "left","centre", and "right". The data here contains the individual securities that make up the custom security.

df_ytm

df_ytm

df_fly

df_fly

Question:

how can I create a new dataframe "df_fts" which is the time series of the individual flys names (with these names as the column headers) in the df_fly["name"], the data for this custom securities time-series should be created by a formula: ((2*centre)-(right+left))

Sorry if there is any confusion here - please let me know if you require more details. Thanks for any help

Mock up df_fts with dummy data

Mock up df_fts with dummy data

I have previously tried creating a new dataframe by copying the df_ytm and adding the new combinations and deleting the old bonds, but this didn't work.

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304
djtmj
  • 1
  • 1
  • You should show more information about the shape of your dataframe. For example, i expect df_ytm to contain 4 columns "instrument type", "YTM", "Month" and "Year", right? Also what is the shape of your df_fly dataframe? It is very unclear in your question. Maybe you can show a mock layout + dummy data – Anthony Kong Jul 03 '19 at 06:44
  • Thanks for your comment - i have added screen shots and a mock layout with dummy data. Hopefully this help better to explain the problem – djtmj Jul 03 '19 at 07:11
  • Screen shots cannot be copied and pasted, so you do not help us to help you ;-). As a result, some of us will just ignore your question... **I** shall unless you provide directly copiable data. As a new user, you should read [ask], what is a [mcve], and for pandas [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Serge Ballesta Jul 03 '19 at 07:56

0 Answers0