Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dict argument to pd.Series constructor should allow Timestamp and tuple as keys #831

Closed
Dr-Irv opened this issue Dec 18, 2023 · 0 comments · Fixed by #843
Closed

dict argument to pd.Series constructor should allow Timestamp and tuple as keys #831

Dr-Irv opened this issue Dec 18, 2023 · 0 comments · Fixed by #843

Comments

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 18, 2023

Additional migration issues for the pd.Series constructor involve passing a dictionary. It fails with a Timestamp or multi-index key whereas before it did not:

sr1 = pd.Series(
        {
            pd.Timestamp(2023, 1, 2): "b",
        }
    )

    sr2 = pd.Series(
        {
            ("a", "b"): "c",
        }
    )
test.py:172: error: Need type annotation for "sr1"  [var-annotated]
test.py:174: error: Dict entry 0 has incompatible type "Timestamp": "str"; expected "str": "ndarray[Any, Any]"  [dict-item]
test.py:178: error: Need type annotation for "sr2"  [var-annotated]
test.py:180: error: Dict entry 0 has incompatible type "Tuple[str, str]": "str"; expected "str": "ndarray[Any, Any]"  [dict-item]

Originally posted by @amgcc in #826 (comment)

Might be best to allow Hashable as the dict key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant