0

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

train dataframe

and this is the scaled data

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

2 Answers 2

2

You can use pandas.DataFrame.replace:

ts_train.replace(ts_train.values, train_data_scaled)
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! this is what i need
@DavidFIM glad to help :)
1

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

1 Comment

Thank you! this is what i need

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.