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

BUG: Correct read_stata #251

Merged
merged 12 commits into from
Sep 27, 2022
15 changes: 0 additions & 15 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -730,24 +730,9 @@ class DataFrame(NDFrame, OpsMixin):
| list[HashableT],
drop: _bool = ...,
append: _bool = ...,
*,
verify_integrity: _bool = ...,
) -> DataFrame: ...
@overload
def set_index(
self,
keys: Label
| Series
| Index
| np.ndarray
| Iterator[HashableT]
| list[HashableT],
drop: _bool = ...,
append: _bool = ...,
inplace: _bool | None = ...,
verify_integrity: _bool = ...,
) -> DataFrame | None: ...
@overload
def reset_index(
self,
level: Level | Sequence[Level] = ...,
Expand Down
20 changes: 10 additions & 10 deletions pandas-stubs/io/stata.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ from pandas._typing import (

@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
filepath_or_buffer: FilePath | ReadBuffer[bytes],
*,
convert_dates: bool = ...,
convert_categoricals: bool = ...,
Expand All @@ -41,23 +41,23 @@ def read_stata(
) -> StataReader: ...
@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
filepath_or_buffer: FilePath | ReadBuffer[bytes],
*,
convert_dates: bool,
convert_categoricals: bool,
index_col: str | None,
convert_missing: bool,
preserve_dtypes: bool,
columns: list[HashableT] | None,
order_categoricals: bool,
convert_dates: bool = ...,
convert_categoricals: bool = ...,
index_col: str | None = ...,
convert_missing: bool = ...,
preserve_dtypes: bool = ...,
columns: list[HashableT] | None = ...,
order_categoricals: bool = ...,
chunksize: int,
iterator: bool = ...,
compression: CompressionOptions = ...,
storage_options: StorageOptions = ...,
) -> StataReader: ...
@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
filepath_or_buffer: FilePath | ReadBuffer[bytes],
*,
convert_dates: bool = ...,
convert_categoricals: bool = ...,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def test_read_stata_iterator():
check(
assert_type(read_stata(str_path, iterator=True), StataReader), StataReader
)
reader = read_stata(str_path, chunksize=1)
check(assert_type(reader, StataReader), StataReader)


def test_clipboard():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ def test_types_rank() -> None:
s.rank(method="dense", ascending=True)
with pytest.warns(FutureWarning, match="Calling Series.rank with numeric_only"):
s.rank(method="first", numeric_only=True)
s2 = pd.Series([1, 1, 2, 5, 6, np.nan])
s2.rank(method="first", numeric_only=True)


def test_types_mean() -> None:
Expand Down