-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinitial.py
More file actions
34 lines (25 loc) · 743 Bytes
/
Copy pathinitial.py
File metadata and controls
34 lines (25 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pandas as pd
def preprocess(path, drop = True):
df = pd.read_csv(path, header=None)
df.columns = ['Company', 'Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
df['Date'] = df['Date'].astype(str)
yearList = []
monthList = []
dayList = []
for values in df['Date']:
year = values[:4]
month = values[4:6]
day = values[6:]
yearList.append(year)
monthList.append(month)
dayList.append(day)
df['Year'] = yearList
df['Month'] = monthList
df['Day'] = dayList
if drop:
del df['Date']
df.to_csv('./data/formatted_ACC_data.csv')
return
if __name__ == '__main__':
path = './data/ACC_all.txt'
preprocess(path, False)