Skip to content

Commit

Permalink
fix: header should be provided with a bool value
Browse files Browse the repository at this point in the history
  • Loading branch information
trgiangdo committed Jun 25, 2024
1 parent 56a1590 commit d3e83f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions taipy/core/data/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
2 changes: 1 addition & 1 deletion taipy/core/data/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d3e83f5

Please sign in to comment.