This commit is contained in:
Pritimay Sarkar
2023-09-21 14:09:02 +05:30
parent 237043816f
commit 46367353e8
6 changed files with 87 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ from firebase_admin import credentials
from firebase_admin import firestore
from google.cloud.firestore_v1.base_query import FieldFilter
import pandas as pd
import datetime
from datetime import datetime
import sys
import os
@@ -53,13 +53,16 @@ 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"]]
# Save the DataFrame to a CSV file
output_filename = "data.csv"
df.to_csv(output_filename, index=False)
output_filename = f'tests_{datetime.today().strftime("%d_%m_%Y_%H_%M")}.xlsx'
downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
output_path = os.path.join(downloads_dir, output_filename)
df.to_csv(output_path, index=False)
writer = pd.ExcelWriter(output_path, engine = 'openpyxl')
df.to_excel(writer, sheet_name = 'data', index=False)
writer.close()
print(f"Data saved to '{output_path}'")