Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

core.indexes.multi.MultiIndex.from_tuples might have a wrong signature #1158

Copy link
Copy link
Closed
@sycai

Description

@sycai
Issue body actions

Describe the bug
The tuples argument type of core.indexes.multi.MultiIndex.from_tuples might be Iterables, not Sequence.

Comparison of the function signature in pandas-stub:

tuples: Sequence[tuple[Hashable, ...]],

and pandas:
https://github.com/pandas-dev/pandas/blob/513e78760a8faee6723908ca23ea83dcabc5dd77/pandas/core/indexes/multi.py#L521

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
import pandas

pandas.MultiIndex.from_tuples(zip(['a'], ['b']))
  1. Indicate which type checker you are using (mypy or pyright).
    mypy

  2. Show the error message received from that type checker while checking your example.

error: Argument 1 to "from_tuples" of "MultiIndex" has incompatible type "zip[tuple[str, str]]"; expected "Sequence[tuple[Hashable, ...]]"  [arg-type]

Please complete the following information:

  • OS: MacOS
  • OS Version: Sequoia 15.3
  • python version: Python 3.10
  • version of type checker: mypy 1.15.0
  • version of installed pandas-stubs: 2.2.3.250308

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.