convert node state enum to integer in the DataFrame to minimize the size of CSV file

This commit is contained in:
Youngjoon Lee 2024-07-05 23:56:48 +09:00
parent 961c1e7581
commit 0cae56c9b4
No known key found for this signature in database
GPG Key ID: B4253AFBA618BF4D

View File

@ -24,7 +24,10 @@ class AllNodeStates:
def analyze(self):
df = pandas.DataFrame(self._table).transpose()
df.columns = [f"Node-{i}" for i in range(len(self._table))]
# Convert NodeState enum to their integer values for analysis
df = df.map(lambda state: state.value)
print(df)
csv_path = f"all_node_states_{datetime.now().isoformat(timespec="seconds")}.csv"
df.to_csv(csv_path)
print(f"\nSaved DataFrame to {csv_path}\n")