I have a data frame 'test_raw', which has many columns. One of its column is 'datetime'. I have used this data frame for machine learning. I have tested the model and got 'test_y_predicted' which is an array of shape (5000,1). I want to make another data frame with these two column i.e. datetime in first column and test_y_predicted in another column and the column names should be 'Date Time and Count'. Please help.
CodePudding user response:
IIUC
new_df = pd.DataFrame({'Datetime': df['datetime'], 'Count': test_y_predicted})
Update
Your solution:
new_df = pd.DataFrame({'Date time': test_raw.datetime,
'Count': test_y_predicted.flatten()})