1
0
Fork 0

Add SamplePath Class

parallel_struct_est
philpMartin 4 years ago
parent 106a9d3a42
commit 4698e68ce7
  1. 22
      main_package/classes/importer.py

@ -16,7 +16,7 @@ class Importer():
def __init__(self, files_path): def __init__(self, files_path):
self.files_path = files_path self.files_path = files_path
self.df_list = [] self.df_list = []
self.trajectories = [] #self.trajectories = []
def import_data_from_csv(self): def import_data_from_csv(self):
"""Importa tutti i file csv presenti nel path files_path in data_frame distinti. """Importa tutti i file csv presenti nel path files_path in data_frame distinti.
@ -45,7 +45,9 @@ class Importer():
""" """
df['State'] = df[df.columns[2:]].apply(lambda row: ''.join(row.values.astype(str)), axis=1) df['State'] = df[df.columns[2:]].apply(lambda row: ''.join(row.values.astype(str)), axis=1)
def merge_value_columns_in_all_frames(self):
for data_frame in self.df_list:
self.merge_value_columns(data_frame)
def get_data_frames(self): def get_data_frames(self):
return self.df_list return self.df_list
@ -57,22 +59,26 @@ class Importer():
def build_trajectories(self):
"""def build_trajectories(self):
for data_frame in self.df_list: for data_frame in self.df_list:
self.merge_value_columns(data_frame) self.merge_value_columns(data_frame)
trajectory = data_frame[['Time','State']].to_numpy() trajectory = data_frame[['Time','State']].to_numpy()
self.trajectories.append(trajectory) self.trajectories.append(trajectory)
#Clear the data_frame #Clear the data_frame
data_frame = data_frame.iloc[0:0] data_frame = data_frame.iloc[0:0]"""
imp = Importer("../data") #imp = Importer("../data")
imp.import_data_from_csv() #imp.import_data_from_csv()
imp.build_trajectories() #imp.build_trajectories()
print(imp.trajectories[0]) #print(imp.trajectories[0])