You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def save_data_to_csv(self, data: dict):
"""
Save the provided data into a CSV file.
Args:
data (dict): The data to be saved.
filename (str): The filename of the CSV file.
"""
# Convert the dictionary to a DataFrame
df = pd.DataFrame(data)
# Check if file exists
if os.path.isfile(filename):
# If it exists, append without writing headers
df.to_csv(filename, mode='a', header=False, index=False)
else:
# If it doesn't exist, write the DataFrame with headers
df.to_csv(filename, index=False)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: