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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
if TYPE_CHECKING:
from collections.abc import (
Hashable,
Iterable,
Mapping,
Sequence,
)
Expand Down Expand Up @@ -637,8 +638,10 @@ def read_csv(
skiprows: list[int] | int | Callable[[Hashable], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
keep_default_na: bool = ...,
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.

na_filter: bool = ...,
verbose: bool = ...,
skip_blank_lines: bool = ...,
Expand Down Expand Up @@ -694,7 +697,10 @@ def read_csv(
skiprows: list[int] | int | Callable[[Hashable], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
na_values: Hashable
| Iterable[Hashable]
| Mapping[Hashable, Iterable[Hashable]]
| None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand Down Expand Up @@ -751,7 +757,10 @@ def read_csv(
skiprows: list[int] | int | Callable[[Hashable], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
na_values: Hashable
| Iterable[Hashable]
| Mapping[Hashable, Iterable[Hashable]]
| None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand Down Expand Up @@ -808,7 +817,10 @@ def read_csv(
skiprows: list[int] | int | Callable[[Hashable], bool] | None = ...,
skipfooter: int = ...,
nrows: int | None = ...,
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = ...,
na_values: Hashable
| Iterable[Hashable]
| Mapping[Hashable, Iterable[Hashable]]
| None = ...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
Expand Down Expand Up @@ -878,7 +890,10 @@ def read_csv(
skipfooter: int = 0,
nrows: int | None = None,
# NA and Missing Data Handling
na_values: Sequence[str] | Mapping[str, Sequence[str]] | None = None,
na_values: Hashable
| Iterable[Hashable]
| Mapping[Hashable, Iterable[Hashable]]
| None = None,
keep_default_na: bool = True,
na_filter: bool = True,
verbose: bool = False,
Expand Down