Skip to content

TYP: Series/DataFrame/Index are not Hashable #113

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

Merged
merged 13 commits into from
Jul 8, 2022
Merged

Conversation

twoertwein
Copy link
Member

@twoertwein
Copy link
Member Author

I cannot reproduce the dist failure of pyright:

poetry run poe install_dist
poetry run poe rename_src
poetry run poe pyright_dist  # no errors

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 7, 2022

I cannot reproduce the dist failure of pyright:

I looked in your log and saw this in the install_dist step:

pandas-stubs is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

So it may be that the caching you introduced is keeping around a version of pandas-stubs from a previous test??

@twoertwein
Copy link
Member Author

So it may be that the caching you introduced is keeping around a version of pandas-stubs from a previous test??

Yes, that must be the case! Thank you for finding this! Let's just cache poetry.lock.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 7, 2022

Yes, that must be the case! Thank you for finding this! Let's just cache poetry.lock.

MIght be a good idea to change build_dist to do a --force-reinstall

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 7, 2022

ping when you want me to review the whole thing (and it's all green)

@twoertwein
Copy link
Member Author

Green and ready for review @Dr-Irv

Caching just poetry.lock seems to make the installation twice as fast while caching poetry.lock and the venv makes it three times as fast. I'm fine just caching poetry.lock.

@@ -428,7 +431,7 @@ class DataFrame(NDFrame, OpsMixin):
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] | Index = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Index is now Hashable, do you need to change this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index was declared to be Hashable but it isn't.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index probably needs to be added to many more annotations. Just added it here because a test was falling without it.

@@ -440,7 +443,7 @@ class DataFrame(NDFrame, OpsMixin):
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] | Index = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. If Index is now Hashable, do you need to change this?

@@ -452,7 +455,7 @@ class DataFrame(NDFrame, OpsMixin):
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] | Index = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. If Index is now Hashable, do you need to change this?

@twoertwein twoertwein changed the title TYP: Series/DataFrame are not Hashable TYP: Series/DataFrame/Index are not Hashable Jul 8, 2022
@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 8, 2022

You could add a negative test to verify that these types are not Hashable, e.g.,

def test_not_hashable():
    def test_func(h: Hashable):
        pass
    test_func(pd.Series()) # type: ignore

@twoertwein
Copy link
Member Author

You could add a negative test to verify that these types are not Hashable, e.g.,

Added and green

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @twoertwein

@Dr-Irv Dr-Irv merged commit 30246cc into pandas-dev:main Jul 8, 2022
@twoertwein twoertwein deleted the none branch February 10, 2024 20:32
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 this pull request may close these issues.

2 participants