Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Last active December 5, 2019 18:20
Show Gist options
  • Select an option

  • Save marcosan93/5dfbbbd6e3a2d36854692108113998ad to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/5dfbbbd6e3a2d36854692108113998ad to your computer and use it in GitHub Desktop.
# 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