mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 12:48:28 +00:00
docs(examples): remove deprecation warnings with export_to_dataframe (#2638)
fix: remove deprecation warnings with export_to_dataframe Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
This commit is contained in:
committed by
GitHub
parent
d6ddf9f4cb
commit
f5528623a7
2
docs/examples/export_tables.py
vendored
2
docs/examples/export_tables.py
vendored
@@ -52,7 +52,7 @@ def main():
|
||||
|
||||
# Export tables
|
||||
for table_ix, table in enumerate(conv_res.document.tables):
|
||||
table_df: pd.DataFrame = table.export_to_dataframe()
|
||||
table_df: pd.DataFrame = table.export_to_dataframe(doc=conv_res.document)
|
||||
print(f"## Table {table_ix}")
|
||||
print(table_df.to_markdown())
|
||||
|
||||
|
||||
5
docs/v2.md
vendored
5
docs/v2.md
vendored
@@ -146,6 +146,9 @@ is now available in conversion results as a `DoclingDocument` object.
|
||||
`DoclingDocument` provides a neat set of APIs to construct, iterate and export content in the document, as shown below.
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
from docling_core.types.doc import TextItem, TableItem
|
||||
|
||||
conv_result: ConversionResult = doc_converter.convert("https://arxiv.org/pdf/2408.09869") # previously `convert_single`
|
||||
|
||||
## Inspect the converted document:
|
||||
@@ -156,7 +159,7 @@ for item, level in conv_result.document.iterate_items():
|
||||
if isinstance(item, TextItem):
|
||||
print(item.text)
|
||||
elif isinstance(item, TableItem):
|
||||
table_df: pd.DataFrame = item.export_to_dataframe()
|
||||
table_df: pd.DataFrame = item.export_to_dataframe(doc=conv_result.document)
|
||||
print(table_df.to_markdown())
|
||||
elif ...:
|
||||
#...
|
||||
|
||||
Reference in New Issue
Block a user