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

Argument 1 to "DatetimeIndex" has incompatible type "dict[str, str]" #828

Open
randolf-scholz opened this issue Dec 15, 2023 · 3 comments
Open

Comments

@randolf-scholz
Copy link
Contributor

import pandas as pd

anomalies = pd.DatetimeIndex({
    "Jan. 1, 2008": "New Year’s Day",
    "Jan. 21, 2008": "Martin Luther King Jr. Day",
    "Feb. 18, 2008": "Washington’s Birthday",
    "Mar. 9, 2008": "Anomaly day",
    "May 26, 2008": "Memorial Day",
    "Jul. 4, 2008": "Independence Day",
    "Sep. 1, 2008": "Labor Day",
    "Oct. 13, 2008": "Columbus Day",
    "Nov. 11, 2008": "Veterans Day",
    "Nov. 27, 2008": "Thanksgiving",
    "Dec. 25, 2008": "Christmas Day",
    "Jan. 1, 2009": "New Year’s Day",
    "Jan. 19, 2009": "Martin Luther King Jr. Day",
    "Feb. 16, 2009": "Washington’s Birthday",
    "Mar. 8, 2009": "Anomaly day",
})
@twoertwein
Copy link
Member

dict[str, str] is not officially documented but Iterable[str] (excluding str itself) might be "array-like" and would allow dict[str, Any].

@randolf-scholz
Copy link
Contributor Author

Btw. I have a potential workaround for the Iterable[str] vs str, but it's not sure if it will be accepted: python/cpython#112319

@twoertwein
Copy link
Member

Btw. I have a potential workaround for the Iterable[str] vs str, but it's not sure if it will be accepted: python/cpython#112319

In pandas we use python/typing#256 (comment) (but that is for a Sequence, not an Iterable - but Sequence might be more array-like than any iterable).

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

No branches or pull requests

2 participants