Skip to content

Commit

Permalink
fix: disable number parsing in multi-type columns
Browse files Browse the repository at this point in the history
Try formatting a table with number parsing and formatting and, if mixed types, retry
with disabled number parsing.

Signed-off-by: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com>
  • Loading branch information
ceberam committed Jan 16, 2024
1 parent 192ef9c commit 8f805f0
Show file tree
Hide file tree
Showing 3 changed files with 67,563 additions and 3 deletions.
8 changes: 5 additions & 3 deletions deepsearch/documents/core/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def export_to_markdown(document: Dict[str, Any]) -> str:
table.append(tmp)

if len(table) > 1 and len(table[0]) > 0:
try:
md_table = tabulate(table[1:], headers=table[0], tablefmt="github")
except ValueError:
md_table = tabulate(table[1:], headers=table[0], tablefmt="github", disable_numparse=True)

markdown_text += tabulate(
table[1:], headers=table[0], tablefmt="github"
)
markdown_text += md_table
markdown_text += "\n\n"

return markdown_text
Loading

0 comments on commit 8f805f0

Please sign in to comment.