E2E calculation per output message, plotting of E2E over time, E2E breakdown charts, E2E message flow charts
This commit is contained in:
parent
241a7c3bf2
commit
8eee45c79a
7 changed files with 1212 additions and 339 deletions
|
@ -8,27 +8,18 @@ def row_to_type(row, type, **type_kwargs):
|
|||
return type(**row, **type_kwargs)
|
||||
|
||||
|
||||
def df_to_type_list(df, type, **type_kwargs):
|
||||
def df_to_type_list(df, type, mappers=None, **type_kwargs):
|
||||
if mappers is not None:
|
||||
for col, mapper in mappers.items():
|
||||
df[col] = df[col].map(mapper)
|
||||
|
||||
has_idx = not isinstance(df.index, pd.RangeIndex)
|
||||
ret_list = []
|
||||
p = tqdm(desc=" ├─ Processing", total=len(df))
|
||||
for row in df.itertuples(index=has_idx):
|
||||
p.update()
|
||||
i=0
|
||||
for row in tqdm(df.itertuples(index=has_idx), desc=f" ├─ Processing {type.__name__}s", total=len(df)):
|
||||
row_dict = row._asdict()
|
||||
if has_idx:
|
||||
row_dict["id"] = row.Index
|
||||
del row_dict["Index"]
|
||||
ret_list.append(row_to_type(row_dict, type, **type_kwargs))
|
||||
return ret_list
|
||||
|
||||
|
||||
def by_index(df, index, type):
|
||||
return df_to_type_list(df.loc[index], type)
|
||||
|
||||
|
||||
def by_column(df, column_name, column_val, type):
|
||||
return df_to_type_list(df[df[column_name] == column_val], type)
|
||||
|
||||
|
||||
def list_to_dict(ls, key='id'):
|
||||
return {getattr(item, key): item for item in ls}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue