| 1234567891011121314151617181920212223242526272829303132 |
- import numpy as np
- import tensorflow as tf
- import pandas as pd
- import matplotlib.pyplot as plt
-
-
- def parser(path):
- df = pd.read_csv(path,na_values='.')
- print(df.shape)
- df = df.interpolate()
- #df = df.dropna()
- print(df.shape)
- #df = df.drop(labels=np.arange(1825)) ### To obtain the same graph than in the article
- print(df.shape)
- return(df)
-
- def preprocess(path):
- df = parser(path)
- print(df)
- df_normalized = df[:]
- df_normalized["WILL5000INDFC"]=df_normalized["WILL5000INDFC"]/np.max(df_normalized["WILL5000INDFC"])
-
- # df.plot()
- # plt.show()
- df_train = df_normalized[:6544]
- df_test = df_normalized[6545:6629]
-
- # df_train.plot()
- # df_test.plot()
- # plt.show()
- return(df_train,df_test)
|