Last active
December 5, 2019 18:20
-
-
Save marcosan93/5dfbbbd6e3a2d36854692108113998ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Library Imports | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| from sklearn.preprocessing import MinMaxScaler | |
| plt.style.use("ggplot") | |
| from keras.models import Sequential | |
| from keras.layers import LSTM, Dense, Dropout | |
| # Loading/Reading in the Data | |
| df = pd.read_csv("BTC-USD.csv") | |
| # Data Preprocessing | |
| ### Setting the datetime index as the date, only selecting the 'Close' column, then only the last 1000 closing prices. | |
| df = df.set_index("Date")[['Close']].tail(1000) | |
| df = df.set_index(pd.to_datetime(df.index)) | |
| # Normalizing/Scaling the Data | |
| scaler = MinMaxScaler() | |
| df = pd.DataFrame(scaler.fit_transform(df), columns=df.columns, index=df.index) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment