Skip to content

DOC: to_markdown should not accept str for buf argument #43605

Closed
@linceaerian

Description

@linceaerian

Hello maintainer,

Is there's not an error in documentation for "to_markdown" function at:

buf: IO[str] | str | None = None,

The documentation indicate to be able to take a str in argument (Path), but when tested, it crash with:

pd.DataFrame(data).to_markdown(args.output_file, index=False)
  File "venv/lib/python3.6/site-packages/pandas/core/frame.py", line 2267, in to_markdown
    buf.writelines(result)
AttributeError: 'str' object has no attribute 'writelines'

In https://pandas.pydata.org/pandas-docs/version/1.0.1/reference/api/pandas.DataFrame.to_markdown.html
the documentation do not have mention of the "str" option.

Version of pandas: 1.1.5
Version of python: 3.6.9

That's all, have a nice day ;)

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsIO DataIO issues that don't fit into a more specific labelTypingtype annotations, mypy/pyright type checkinggood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions