Skip to content

Changed read_csv type hint for na_values and added tests Issue#53813 #54486

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 3 commits into from
Aug 20, 2023

Conversation

kvn4
Copy link
Contributor

@kvn4 kvn4 commented Aug 10, 2023

na_values: Hashable
| Iterable[Hashable]
| Mapping[Hashable, Iterable[Hashable]]
| None = ...,
Copy link
Member

Choose a reason for hiding this comment

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

You could remove None if you like to, it is Hashable.

@kvn4
Copy link
Contributor Author

kvn4 commented Aug 14, 2023

Hi @twoertwein and @lithomas1 thank you for the feedback. Do you know where the ellipses issue could be coming from? I only changed the na_values type hint for the read_csv() function.

@twoertwein
Copy link
Member

Hi @twoertwein and @lithomas1 thank you for the feedback. Do you know where the ellipses issue could be coming from? I only changed the na_values type hint for the read_csv() function.

You seem to have changed it :) You can always use git add --patch to confirm individual changes you want to add.

You can simply replace = ... with = None in the non-overload definition.

The easiest way to remove the test is probably git checkout <commit id from before your changes> pandas/tests/io/parser/test_na_values.py and then add and commit that.

@gfyoung gfyoung added the IO CSV read_csv, to_csv label Aug 17, 2023
@kvn4
Copy link
Contributor Author

kvn4 commented Aug 17, 2023

Hi @twoertwein do the changes I made look good?

@twoertwein
Copy link
Member

Hi @twoertwein do the changes I made look good?

Now you use = None everywhere. You want = None for the function definition that doesn't have the @overload but otherwise use = ....

It might be better to use Sequence instead of Iterable (not sure whether any iterable is accepted).

You can remove the test changes you made.

@kvn4
Copy link
Contributor Author

kvn4 commented Aug 20, 2023

Hi @twoertwein do the changes I made look good?

Now you use = None everywhere. You want = None for the function definition that doesn't have the @overload but otherwise use = ....

It might be better to use Sequence instead of Iterable (not sure whether any iterable is accepted).

You can remove the test changes you made.

Thank you for the feedback. I made the changes

@twoertwein twoertwein merged commit 7915acb into pandas-dev:main Aug 20, 2023
@twoertwein
Copy link
Member

Thanks @kvn4 !

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

Successfully merging this pull request may close these issues.

BUG: read_csv type hint for na_values should include non-iterables as valid arguments
4 participants