0

I am running a process where I am trying to merge some predicted values back into another dataframe which has the 'actual' values.

The problem I'm having is that after the merge is done, I end up with a new dataframe that only has 1 row. In this case, I am wanting to update the predicted_sales column in the parent dataframe to the value in yhat if the date matches.

Is it possible to take a smaller dataframe (in this case, a dataframe with 1 record) and marge it into a larger dataframe (n records) without having to go through and iterate on every row and see if a value should be upated?

I thought I was on the right path with pd.merge but it's not looking right:

result_df = pd.merge(orig_df, sales_forecast_df, on='date')

enter image description here

mwilson
  • 12,295
  • 7
  • 55
  • 95

0 Answers0