def data_to_csv(data_obj: RadioData, filename: str = "buggydata.csv"): # Creating a new CSV if there doesn't exist one if not csv_funcs.exists_csv(filename): csv_funcs.create_csv_file(filename, data_obj.get_fieldnames()) # Writing to the CSV csv_funcs.write_to_csv(filename, data_obj.get_data_dict())
def data_to_csv(data_obj: RadioData, filename: str): # Creating a new CSV if there doesn't exist one if not exists_csv(filename): create_csv_file(filename, data_obj.get_fieldnames()) # Writing to the CSV # (For loop is there for testing purposes; script will only add one data row per call) # for i in range(5): write_to_csv(filename, randomize_data(data_obj.get_data_dict()))