-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathLoadData.py
More file actions
38 lines (24 loc) · 1016 Bytes
/
LoadData.py
File metadata and controls
38 lines (24 loc) · 1016 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
35
36
37
38
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 12 14:04:23 2018
@author: GLA_A
"""
#%%
import pandas as pd
import os
#%%
def load_data(pth, names=None, n_data_sets=4):
if names is None:
names = ['unit_nr', 'time', 'os_1', 'os_2', 'os_3']
names += ['sensor_{0:02d}'.format(s + 1) for s in range(26)]
dc = {}
for i in range(n_data_sets):
p = os.path.join(pth, 'RUL_FD00{}.txt'.format(i+1))
df_RUL = pd.read_csv(p, sep= ' ', header=None, names=['RUL_actual'], index_col=False)
p = os.path.join(pth, 'train_FD00{}.txt'.format(i+1))
df_train = pd.read_csv(p, sep= ' ', header=None, names=names, index_col=False)
p = os.path.join(pth, 'test_FD00{}.txt'.format(i+1))
df_test = pd.read_csv(p, sep= ' ', header=None, names=names, index_col=False)
s = 'FD_00{}'.format(i+1)
dc[s] = {'df_RUL': df_RUL, 'df_train': df_train, 'df_test': df_test}
return dc