Spaces:
Running
Running
Blair Yang
commited on
Commit
•
01022c9
1
Parent(s):
63eddff
test
Browse files
app.py
CHANGED
@@ -13,10 +13,12 @@ def append_to_csv(output_path, row_data, header_names):
|
|
13 |
with lock:
|
14 |
# Check if file exists and is not empty
|
15 |
if os.path.exists(output_path) and os.path.getsize(output_path) > 0:
|
|
|
16 |
# File exists and is not empty, append without headers
|
17 |
df = pd.DataFrame([row_data])
|
18 |
df.to_csv(output_path, mode='a', header=False, index=False)
|
19 |
else:
|
|
|
20 |
# File does not exist or is empty, write with headers
|
21 |
df = pd.DataFrame([row_data], columns=header_names)
|
22 |
df.to_csv(output_path, mode='w', header=True, index=False)
|
|
|
13 |
with lock:
|
14 |
# Check if file exists and is not empty
|
15 |
if os.path.exists(output_path) and os.path.getsize(output_path) > 0:
|
16 |
+
print(f"Appending to {output_path}")
|
17 |
# File exists and is not empty, append without headers
|
18 |
df = pd.DataFrame([row_data])
|
19 |
df.to_csv(output_path, mode='a', header=False, index=False)
|
20 |
else:
|
21 |
+
print(f"Writing to {output_path}")
|
22 |
# File does not exist or is empty, write with headers
|
23 |
df = pd.DataFrame([row_data], columns=header_names)
|
24 |
df.to_csv(output_path, mode='w', header=True, index=False)
|