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.

1234567891011121314151617181920212223242526272829
  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()
  8. df = df.dropna().reset_index(drop=True)
  9. #df = df.drop(labels=np.arange(1825)) ### To obtain the same graph than in the article
  10. return(df)
  11. def preprocess(path):
  12. df = parser(path)
  13. df_normalized = df[:]
  14. df_normalized["WILL5000INDFC"]=df_normalized["WILL5000INDFC"]/np.max(df_normalized["WILL5000INDFC"])
  15. index_train = int(df_normalized[df_normalized["DATE"]=="2020-01-31"].index.array[0])
  16. # df.plot()
  17. # plt.show()
  18. df_train = df_normalized[:index_train]
  19. df_test = df_normalized[index_train+1:index_train+85]
  20. # df_train.plot()
  21. # df_test.plot()
  22. # plt.show()
  23. return(df_train,df_test,index_train)