remove device type and location, add counts

This commit is contained in:
Pritimay Sarkar
2023-09-28 11:10:37 +05:30
parent 28feaa8efe
commit b05d882cc9

View File

@@ -52,7 +52,10 @@ df = pd.DataFrame(data)
print(df)
print(df.size)
df = df[["_id", "classificationResult", "calculatedRatio", "deviceId", "deviceRatio", "deviceType", "kitSerial", "led1Average", "led1Buffer", "led1Sample", "led2Average", "led2Buffer", "led2Sample", "location", "deviceSerialNumber", "name", "testTime", "resultData"]]
df = df[["_id", "classificationResult", "calculatedRatio", "deviceId", "deviceRatio", "kitSerial", "led1Average", "led1Buffer", "led1Sample", "led2Average", "led2Buffer", "led2Sample", "deviceSerialNumber", "name", "testTime"]]
# df = df.groupby(["classificationResult"]).describe()
df_count = df.groupby(["classificationResult"]).describe()["calculatedRatio"]["count"]
print(df.groupby(["classificationResult"]).describe()["calculatedRatio"]["count"])
# Save the DataFrame to a CSV file
output_filename = f'tests_{datetime.today().strftime("%d_%m_%Y_%H_%M")}.xlsx'
@@ -61,6 +64,7 @@ downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
output_path = os.path.join(downloads_dir, output_filename)
writer = pd.ExcelWriter(output_path, engine = 'openpyxl')
df.to_excel(writer, sheet_name = 'data', index=False)
df_count.to_excel(writer, sheet_name = "count")
writer.close()
print(f"Data saved to '{output_path}'")