|
6 | 6 | import pandas as pds |
7 | 7 |
|
8 | 8 |
|
9 | | -def _to_csv(hapi_csv_file: HapiCsvFile, dest:io.IOBase, with_headers=True) -> bool: |
| 9 | +def _to_csv(hapi_csv_file: HapiCsvFile, dest:io.IOBase, with_headers: bool = True) -> bool: |
10 | 10 | np_startDate = hapi_csv_file.time_axis[0] |
11 | 11 | np_stopDate = hapi_csv_file.time_axis[-1] |
12 | 12 | startDate = np_startDate.astype("datetime64[us]").astype("O") |
@@ -39,14 +39,14 @@ def _to_csv(hapi_csv_file: HapiCsvFile, dest:io.IOBase, with_headers=True) -> bo |
39 | 39 | return True |
40 | 40 |
|
41 | 41 |
|
42 | | -def save_hapi_csv(hapi_csv_file: HapiCsvFile, file: Optional[Union[str, io.IOBase]] = None) -> Union[bool, Buffer]: |
| 42 | +def save_hapi_csv(hapi_csv_file: HapiCsvFile, file: Optional[Union[str, io.IOBase]] = None, with_headers: bool = True) -> Union[bool, Buffer]: |
43 | 43 | if type(file) is str: |
44 | 44 | with open(file, 'wb') as f: |
45 | | - return _to_csv(hapi_csv_file, f) |
| 45 | + return _to_csv(hapi_csv_file, f, with_headers=with_headers) |
46 | 46 | elif hasattr(file, 'write'): |
47 | | - return _to_csv(hapi_csv_file, file) |
| 47 | + return _to_csv(hapi_csv_file, file, with_headers=with_headers) |
48 | 48 | elif file is None: |
49 | 49 | buff = io.BytesIO() |
50 | | - _to_csv(hapi_csv_file, buff) |
| 50 | + _to_csv(hapi_csv_file, buff, with_headers=with_headers) |
51 | 51 | return buff.getvalue() |
52 | 52 | raise ValueError("Invalid file type") |
0 commit comments