Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrl committed Dec 12, 2024
1 parent 59b735f commit 669550d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions haystack/components/converters/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ def _extract_tables(self, bytestream: ByteStream) -> Tuple[List[str], List[Dict]

tables = []
metadata = []
for key in updated_sheet_to_dataframe:
for key, value in updated_sheet_to_dataframe.items():
if self.table_format == "csv":
resolved_kwargs = {"index": True, "header": True, "lineterminator": "\n", **self.table_format_kwargs}
tables.append(updated_sheet_to_dataframe[key].to_csv(**resolved_kwargs))
tables.append(value.to_csv(**resolved_kwargs))
else:
resolved_kwargs = {
"index": True,
"headers": updated_sheet_to_dataframe[key].columns,
"headers": value.columns,
"tablefmt": "pipe",
**self.table_format_kwargs,
}
# to_markdown uses tabulate
tables.append(updated_sheet_to_dataframe[key].to_markdown(**resolved_kwargs))
tables.append(value.to_markdown(**resolved_kwargs))
# add sheet_name to metadata
metadata.append({"xlsx": {"sheet_name": key}})
return tables, metadata

0 comments on commit 669550d

Please sign in to comment.