You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wilshire.py 727B

123456789101112131415161718192021222324
  1. import numpy as np
  2. import tensorflow as tf
  3. import pandas as pd
  4. import matplotlib.pyplot as plt
  5. def parser(path):
  6. df = pd.read_csv(path,na_values='.')
  7. #df = df.interpolate() ### Interpolate or dropna for bank holidays
  8. df = df.dropna().reset_index(drop=True)
  9. return(df)
  10. def preprocess(path):
  11. df = parser(path)
  12. df_normalized = df[:]
  13. df_normalized["WILL5000INDFC"]=df_normalized["WILL5000INDFC"]/np.max(df_normalized["WILL5000INDFC"])
  14. index_train = int(df_normalized[df_normalized["DATE"]=="2020-01-31"].index.array[0])
  15. df_train = df_normalized[:index_train]
  16. df_test = df_normalized[index_train+1:index_train+85] #Between 02-01 and 05-31
  17. return(df_train,df_test,index_train)