1

I have two dataframes and I want to subtract one from the other.

For some reason, pd.sub does not work. I have read the other questions but None of the Solutions seem to work. I also tried "fill_value" etc. Below is my Code:

stock_returns = pd.DataFrame([[10,100,200],
                          [15, 115, 215],
                         [20,120, 220],
                         [25,125,225],
                         [30,130,230]], columns=['A', 'B', 'C'])

p_df = pd.DataFrame([1,2,3,4,5])

print(stock_returns)
print(p_df)
print(stock_returns.sub(p_df, axis=0))
MANGo 92
  • 81
  • 1
  • 8

0 Answers0