Skip to content
Merged
Show file tree
Hide file tree
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
126 changes: 65 additions & 61 deletions pandas-stubs/core/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ from collections.abc import (
Hashable,
Iterable,
Mapping,
MutableMapping,
Sequence,
)
import datetime as dt
import sqlite3
import sys
from typing import (
Any,
ClassVar,
Expand All @@ -21,6 +21,7 @@ from typing import (
overload,
)

import numpy as np
from pandas import Index
from pandas.core.resample import DatetimeIndexResampler
from pandas.core.series import Series
Expand All @@ -40,13 +41,16 @@ from pandas._typing import (
ExcelWriterMergeCells,
FilePath,
FileWriteMode,
FloatFormatType,
FormattersType,
Frequency,
HashableT1,
HashableT2,
HDFCompLib,
IgnoreRaise,
IndexLabel,
Level,
ListLike,
OpenFileErrors,
P,
StorageOptions,
Expand All @@ -56,9 +60,11 @@ from pandas._typing import (
TimeGrouperOrigin,
TimestampConvertibleTypes,
WriteBuffer,
np_ndarray,
WriteExcelBuffer,
np_1darray,
)

from pandas.io.excel import ExcelWriter
from pandas.io.pytables import HDFStore
from pandas.io.sql import SQLTable

Expand Down Expand Up @@ -95,15 +101,23 @@ class NDFrame:
@final
def __round__(self, decimals: int = ...) -> Self: ...
@final
def __contains__(self, key) -> _bool: ...
def __contains__(self, key: Any) -> _bool: ...
@property
def empty(self) -> _bool: ...
__array_priority__: int = ...
def __array__(self, dtype=...) -> np_ndarray: ...
if sys.version_info >= (3, 11):
def __array__(
self, dtype: _str | np.dtype = ..., copy: _bool | None = ...
) -> np_1darray: ...
else:
def __array__(
self, dtype: _str | np.dtype[Any] = ..., copy: _bool | None = ...
) -> np_1darray: ...

@final
def to_excel(
self,
excel_writer,
excel_writer: FilePath | WriteExcelBuffer | ExcelWriter,
sheet_name: _str = "Sheet1",
na_rep: _str = "",
float_format: _str | None = ...,
Expand Down Expand Up @@ -220,8 +234,8 @@ class NDFrame:
header: _bool | list[_str] = ...,
index: _bool = ...,
na_rep: _str = ...,
formatters=...,
float_format=...,
formatters: FormattersType | None = None,
float_format: FloatFormatType | None = None,
sparsify: _bool | None = ...,
index_names: _bool = ...,
bold_rows: _bool = ...,
Expand All @@ -245,8 +259,8 @@ class NDFrame:
header: _bool | list[_str] = ...,
index: _bool = ...,
na_rep: _str = ...,
formatters=...,
float_format=...,
formatters: FormattersType | None = None,
float_format: FloatFormatType | None = None,
sparsify: _bool | None = ...,
index_names: _bool = ...,
bold_rows: _bool = ...,
Expand Down Expand Up @@ -312,115 +326,113 @@ class NDFrame:
errors: OpenFileErrors = ...,
storage_options: StorageOptions = ...,
) -> _str: ...
@final
def __delitem__(self, idx: Hashable) -> None: ...
@overload
def drop(
self,
labels=...,
labels: Hashable | ListLike = None,
*,
axis=...,
axis: Axis = 0,
index: None,
columns=...,
level=...,
inplace=...,
errors=...,
columns: Hashable | Iterable[Hashable] = None,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = "raise",
) -> Never: ...
@overload
def drop(
self,
labels=...,
labels: Hashable | ListLike = None,
*,
axis=...,
index=...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index = None,
columns: None,
level=...,
inplace=...,
errors=...,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = "raise",
) -> Never: ...
@overload
def drop(
self,
labels: None,
*,
axis=...,
index=...,
columns=...,
level=...,
inplace=...,
errors=...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index = None,
columns: Hashable | Iterable[Hashable] = None,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = "raise",
) -> Never: ...
@overload
def drop(
self,
labels: None = None,
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] | Index = ...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index = None,
columns: Hashable | Iterable[Hashable],
level: Level | None = ...,
level: Level | None = None,
inplace: Literal[True],
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> None: ...
@overload
def drop(
self,
labels: None = None,
*,
axis: Axis = ...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index,
columns: Hashable | Iterable[Hashable] = ...,
level: Level | None = ...,
columns: Hashable | Iterable[Hashable] = None,
level: Level | None = None,
inplace: Literal[True],
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> None: ...
@overload
def drop(
self,
labels: Hashable | Sequence[Hashable] | Index,
labels: Hashable | ListLike,
*,
axis: Axis = ...,
axis: Axis = 0,
index: None = None,
columns: None = None,
level: Level | None = ...,
level: Level | None = None,
inplace: Literal[True],
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> None: ...
@overload
def drop(
self,
labels: None = None,
*,
axis: Axis = ...,
index: Hashable | Sequence[Hashable] | Index = ...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index = None,
columns: Hashable | Iterable[Hashable],
level: Level | None = ...,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> Self: ...
@overload
def drop(
self,
labels: None = None,
*,
axis: Axis = ...,
axis: Axis = 0,
index: Hashable | Sequence[Hashable] | Index,
columns: Hashable | Iterable[Hashable] = ...,
level: Level | None = ...,
columns: Hashable | Iterable[Hashable] = None,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> Self: ...
@overload
def drop(
self,
labels: Hashable | Sequence[Hashable] | Index,
labels: Hashable | ListLike,
*,
axis: Axis = ...,
axis: Axis = 0,
index: None = None,
columns: None = None,
level: Level | None = ...,
level: Level | None = None,
inplace: Literal[False] = False,
errors: IgnoreRaise = ...,
errors: IgnoreRaise = "raise",
) -> Self: ...
@overload
def pipe(
Expand All @@ -437,14 +449,6 @@ class NDFrame:
**kwargs: Any,
) -> T: ...
@final
def __finalize__(self, other, method=..., **kwargs: Any) -> Self: ...
@final
def __setattr__(self, name: _str, value) -> None: ...
@final
def __copy__(self, deep: _bool = ...) -> Self: ...
@final
def __deepcopy__(self, memo: MutableMapping[int, Any] | None = None) -> Self: ...
@final
def convert_dtypes(
self,
infer_objects: _bool = True,
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ ignore = [
# TODO: remove when computations are fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
]
"*generic.pyi" = [
# TODO: remove when generic.pyi is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
]
"*array*" = [
# TODO: remove when array is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
Expand Down