Reputation: 57
I have a time series dataframe that i want to predict with LSTM but i cant replace the train and test value with the scaled value.
This is the dataframe
and this is the scaled data
How can i put the scaled value replacing the value in train dataframe ?Since the index is a date and i cant do loop to replacing the data. and i cant replace data in dataframe either.
Thanks in advance
Upvotes: 0
Views: 53
Reputation: 4771
You can use pandas.DataFrame.replace
:
ts_train.replace(ts_train.values, train_data_scaled)
Upvotes: 2
Reputation: 2919
You can use a couple of methods, if you want to reassign the data you can create a new dataframe and set the indicies to ts_train_scaled
with a command like
pd.Dataframe(data=ts_train_scaled, index=ts_train.index)
If you truly need to replace the value in ts_train
, you can use the DataFrame replace command which allows you to replace the value dynamically
Upvotes: 1