camelot-dev / camelot

A Python library to extract tabular data from PDFs
https://camelot-py.readthedocs.io
MIT License
2.96k stars 466 forks source link

Can't set mode using to_* methods #317

Open captn3m0 opened 2 years ago

captn3m0 commented 2 years ago

Describe the bug

The file writing mode cannot be set using camelot

Steps to reproduce the bug

Attempt to use to_markdown while setting a custom mode to append all tables to the same file.

Expected behavior

The pandas to_markdown method should get invoked with the correct mode: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_markdown.html

Code

tables = camelot.read_pdf(pdf)
for t in tables:
        t.to_markdown(fn, mode='at')

Additional Context

This might apply to other methods as well.