|
|
|
@ -15,11 +15,10 @@ class JsonImporter(AbstractImporter): |
|
|
|
|
super(JsonImporter, self).__init__(files_path) |
|
|
|
|
|
|
|
|
|
def import_data(self): |
|
|
|
|
data = self.read_json_file() |
|
|
|
|
self.import_trajectories(data) |
|
|
|
|
self.import_structure(data) |
|
|
|
|
self.import_variables(data) |
|
|
|
|
|
|
|
|
|
raw_data = self.read_json_file() |
|
|
|
|
self.import_trajectories(raw_data) |
|
|
|
|
self.import_structure(raw_data) |
|
|
|
|
self.import_variables(raw_data) |
|
|
|
|
|
|
|
|
|
def import_trajectories(self, raw_data): |
|
|
|
|
self.normalize_trajectories(raw_data, 0, 'samples') |
|
|
|
@ -47,6 +46,12 @@ class JsonImporter(AbstractImporter): |
|
|
|
|
for sample_indx, sample in enumerate(raw_data[indx][trajectories_key]): |
|
|
|
|
self.df_samples_list.append(pd.json_normalize(raw_data[indx][trajectories_key][sample_indx])) |
|
|
|
|
|
|
|
|
|
def build_list_of_samples_array(self, data_frame): |
|
|
|
|
columns_list = [] |
|
|
|
|
for column in data_frame: |
|
|
|
|
columns_list.append(data_frame[column].to_numpy()) |
|
|
|
|
return columns_list |
|
|
|
|
|
|
|
|
|
def clear_data_frames(self): |
|
|
|
|
""" |
|
|
|
|
Rimuove tutti i valori contenuti nei data_frames presenti in df_list |
|
|
|
@ -55,13 +60,14 @@ class JsonImporter(AbstractImporter): |
|
|
|
|
Returns: |
|
|
|
|
void |
|
|
|
|
""" |
|
|
|
|
for data_frame in self.df_list: |
|
|
|
|
data_frame = data_frame.iloc[0:0] |
|
|
|
|
|
|
|
|
|
for indx in range(len(self.df_samples_list)): |
|
|
|
|
#data_frame = data_frame.iloc[0:0] |
|
|
|
|
self.df_samples_list[indx] = self.df_samples_list[indx].iloc[0:0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ij = JsonImporter("../data") |
|
|
|
|
"""ij = JsonImporter("../data") |
|
|
|
|
ij.import_data() |
|
|
|
|
print(ij.df_samples_list[7]) |
|
|
|
|
#print(ij.df_samples_list[7]) |
|
|
|
|
print(ij.df_structure) |
|
|
|
|
print(ij.df_variables) |
|
|
|
|
print((ij.build_list_of_samples_array(0)[1].size))""" |
|
|
|
|