Nazhar commited on
Commit
f956979
·
verified ·
1 Parent(s): a9662c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -779,8 +779,15 @@ with chat:
779
 
780
  # Convert data to a DataFrame
781
  queries = pd.DataFrame(queries_data)
 
 
 
 
 
 
782
  # Append data to an existing CSV file or create a new one if it doesn't exist
783
- queries.to_csv('Queries.csv', mode='a', index=False, header=not os.path.exists('Queries.csv'))
 
784
 
785
 
786
 
 
779
 
780
  # Convert data to a DataFrame
781
  queries = pd.DataFrame(queries_data)
782
+ # # Append data to an existing CSV file or create a new one if it doesn't exist
783
+ # queries.to_csv('Queries.csv', mode='a', index=False, header=not os.path.exists('Queries.csv'))
784
+
785
+ # Check if the file already exists
786
+ file_exists = os.path.exists('Queries.csv')
787
+
788
  # Append data to an existing CSV file or create a new one if it doesn't exist
789
+ with open('Queries.csv', 'a') as f:
790
+ queries.to_csv(f, header=not file_exists, index=False)
791
 
792
 
793