I’m trying to create a graph of PnL vs. price from a simulation of a call option. I have to extract data from the results of the simulation. I wanted to combine the extracted data into a single dataframe, but my resulting dataframe does not join them. I found out that the index of the two extract dataframes is different…..would appreciate if someone could explain what’s going on.
In the screenshot below – I see the terminal_price dataframe having an Index type object. The other dataframe of PnL values however is a RangeIndex. I checked…both the df’s have same dimensions and are the same class; i.e. pandas.core.frame.DataFrame. So I’m not sure exactly what’s going on here…..why do I get two different index types? Would appreciate some guidance. I will try to convert the data extracts into pure series and then convert back into a concatenated dataframe….but in the meantime….why is this even happening?
I’m not able to show the entire working (just too much to copy paste), but here’s how I extracted the relevant data:
terminal_price = dhedge_strat['path'].iloc[-1:,].T
terminal_price.rename(columns = {999 : 'term_price'}, inplace=True)
terminal_pnl = pd.DataFrame(dhedge_err_['hedge_error']).reset_index()