Spaces:
Sleeping
Sleeping
modified update_data file
Browse files- update_data.py +2 -3
update_data.py
CHANGED
|
@@ -3,7 +3,6 @@ import logging
|
|
| 3 |
import pandas as pd
|
| 4 |
import requests
|
| 5 |
import subprocess
|
| 6 |
-
from datetime import datetime
|
| 7 |
from oauth2client.service_account import ServiceAccountCredentials
|
| 8 |
|
| 9 |
# Set up logging
|
|
@@ -46,7 +45,7 @@ def save_to_csv(df, file_path):
|
|
| 46 |
raise ValueError("Empty DataFrame")
|
| 47 |
try:
|
| 48 |
df.to_csv(file_path, index=False)
|
| 49 |
-
logging.info(f"Data saved successfully
|
| 50 |
except Exception as e:
|
| 51 |
logging.error(f"Failed to save data: {e}")
|
| 52 |
raise
|
|
@@ -59,7 +58,7 @@ def git_commit_push():
|
|
| 59 |
subprocess.run(['git', 'add', 'omoku_data.csv'], check=True)
|
| 60 |
subprocess.run(['git', 'commit', '-m', 'Update dataset'], check=True)
|
| 61 |
subprocess.run(['git', 'push'], check=True)
|
| 62 |
-
logging.info(f"Data updated successfully
|
| 63 |
except subprocess.CalledProcessError as e:
|
| 64 |
if "nothing to commit" in str(e.stderr):
|
| 65 |
logging.info("No changes to commit.")
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import requests
|
| 5 |
import subprocess
|
|
|
|
| 6 |
from oauth2client.service_account import ServiceAccountCredentials
|
| 7 |
|
| 8 |
# Set up logging
|
|
|
|
| 45 |
raise ValueError("Empty DataFrame")
|
| 46 |
try:
|
| 47 |
df.to_csv(file_path, index=False)
|
| 48 |
+
logging.info(f"Data saved successfully.")
|
| 49 |
except Exception as e:
|
| 50 |
logging.error(f"Failed to save data: {e}")
|
| 51 |
raise
|
|
|
|
| 58 |
subprocess.run(['git', 'add', 'omoku_data.csv'], check=True)
|
| 59 |
subprocess.run(['git', 'commit', '-m', 'Update dataset'], check=True)
|
| 60 |
subprocess.run(['git', 'push'], check=True)
|
| 61 |
+
logging.info(f"Data updated successfully.")
|
| 62 |
except subprocess.CalledProcessError as e:
|
| 63 |
if "nothing to commit" in str(e.stderr):
|
| 64 |
logging.info("No changes to commit.")
|