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:
Cesar Berrospi Ramis
2025-11-17 12:48:41 +01:00
committed by GitHub
parent d6ddf9f4cb
commit f5528623a7
3 changed files with 5 additions and 5 deletions

View File

@@ -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
View File

@@ -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 ...:
#...

View File

@@ -171,9 +171,6 @@ def verify_table_v2(true_item: TableItem, pred_item: TableItem, fuzzy: bool):
assert true_item.data is not None, "documents are expected to have table data"
assert pred_item.data is not None, "documents are expected to have table data"
# print("True: \n", true_item.export_to_dataframe().to_markdown())
# print("Pred: \n", true_item.export_to_dataframe().to_markdown())
for i, row in enumerate(true_item.data.grid):
for j, col in enumerate(true_item.data.grid[i]):
# print("true: ", true_item.data[i][j].text)