From d3e83f5b75ca2a2361da3b738d3971a79207f294 Mon Sep 17 00:00:00 2001 From: trgiangdo Date: Tue, 25 Jun 2024 11:29:39 +0700 Subject: [PATCH] fix: header should be provided with a bool value --- taipy/core/data/csv.py | 4 ++-- taipy/core/data/excel.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/taipy/core/data/csv.py b/taipy/core/data/csv.py index e5d5435c88..472f77b4dc 100644 --- a/taipy/core/data/csv.py +++ b/taipy/core/data/csv.py @@ -188,7 +188,7 @@ def _write(self, data: Any): ) else: self._convert_data_to_dataframe(exposed_type, data).to_csv( - self._path, index=False, encoding=self.properties[self.__ENCODING_KEY], header=None + self._path, index=False, encoding=self.properties[self.__ENCODING_KEY], header=False ) def write_with_column_names(self, data: Any, columns: Optional[List[str]] = None, job_id: Optional[JobId] = None): @@ -201,6 +201,6 @@ def write_with_column_names(self, data: Any, columns: Optional[List[str]] = None """ df = self._convert_data_to_dataframe(self.properties[self._EXPOSED_TYPE_PROPERTY], data) if columns and isinstance(df, pd.DataFrame): - df.columns = columns + df.columns = pd.Index(columns, dtype="object") df.to_csv(self._path, index=False, encoding=self.properties[self.__ENCODING_KEY]) self.track_edit(timestamp=datetime.now(), job_id=job_id) diff --git a/taipy/core/data/excel.py b/taipy/core/data/excel.py index 92f201df6a..d9ee54fa31 100644 --- a/taipy/core/data/excel.py +++ b/taipy/core/data/excel.py @@ -301,7 +301,7 @@ def __write_excel_with_multiple_sheets(self, data: Any, columns: List[str] = Non if columns: data[key].columns = columns - df.to_excel(writer, key, index=False, header=self.properties[self._HAS_HEADER_PROPERTY] or None) + df.to_excel(writer, key, index=False, header=self.properties[self._HAS_HEADER_PROPERTY] or False) def _write(self, data: Any): if isinstance(data, Dict):