Skip to content

tabulate.tabulate should accept pd.DataFrame #16708

Description

@A5rocks
$ uv run mypy -c "import tabulate; import pandas as pd; tabulate.tabulate(pd.DataFrame({}))"
<string>:1: error: Argument 1 to "tabulate" has incompatible type "DataFrame"; expected "Mapping[Any, Iterable[Any]] | Iterable[Iterable[Any]]"  [arg-type]
<string>:1: note: Following member(s) of "DataFrame" have conflicts:
<string>:1: note:     Expected:
<string>:1: note:         def __iter__(self) -> Iterator[Iterable[Any]]
<string>:1: note:     Got:
<string>:1: note:         def __iter__(self) -> Iterator[Hashable]
Found 1 error in 1 file (checked 1 source file)

(that's with pandas-stubs installed)

but the PyPI description says that pandas.DataFrame is accepted!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions