コード例 #1
0
ファイル: ReadersWriters.py プロジェクト: minghao2016/T-CARER
 def reset_csv(path: str, title: str, ext: str = "csv"):
     """Reset the CSV file reader/writer.
     :param path: the directory path of the CSV file.
     :param title: the file name of the CSV file.
     :param ext: the extension of the CSV file (default: 'csv').
     """
     reader = CsvFile()
     reader.set(path, title, ext)
     reader.reset()
コード例 #2
0
ファイル: ReadersWriters.py プロジェクト: minghao2016/T-CARER
 def save_csv(path: str,
              title: str,
              data: Callable[[List, Dict, PandasDataFrame], None],
              append: bool = False,
              ext: str = "csv",
              **kwargs: Any):
     """Append to CSV file using dataframe, dictionary or list.
     :param path: the directory path of the CSV file.
     :param title: the file name of the CSV file.
     :param data: the data to write.
     :param append: indicates if data to be appended to an existing file.
     :param ext: the extension of the CSV file (default: 'csv').
     :param kwargs: any other arguments that the selected writer may accept.
     """
     writer = CsvFile()
     writer.set(path, title, ext)
     if append is False:
         writer.reset()
     writer.append(data, **kwargs)