-1

I created timeseries predictions and now would like to append to my original dataframe but on one column instead I'm getting two. I presume it might be down to columns names on both dfs i.e. on original called 'df2_val' column with data is called 'value'. On predictions one called 'weighted_average_pred' there is no column name it only displays '0' on the label. Once I have actual and predictions in one column I'd like to also add column with dates.

df2_val > records from 0 to 49 weighted_average_pred > records from 50 to 57

Code:

weighted_average_pred.columns=['value'] # > didn't work, still see column label as '0'

final_df = pd.concat([df2_val, weighted_average_pred], axis=1)

enter image description here

Paul H
  • 65,268
  • 20
  • 159
  • 136
  • 1
    Probably your columns don’t have the same name. But it’s impossible to tell. Click the pandas tag in your question. Click on “Learn more”. Read this question and its answers: https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples – Paul H Aug 11 '23 at 15:01
  • yes, you're right thus I used below code ============================================== weighted_average_pred.rename({'unnamed:0':'value'}, inplace=True ) ============================================== didn't get any error but then nothing has changed, "weighted_average_pred" still shows "0" as column label – Bart Bart Aug 11 '23 at 15:26
  • Did you read the question and answers in the link I provided? – Paul H Aug 11 '23 at 18:44

0 Answers0