Skip to content

Commit 2b42db9

Browse files
Merge branch 'main' of github.com:loicdiridollou/pandas-stubs into gh1089_fix_nightly
2 parents 0bd57d0 + 2b0279e commit 2b42db9

File tree

14 files changed

+610
-320
lines changed

14 files changed

+610
-320
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
1010
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1111
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
12+
[![Typing: stubs](https://img.shields.io/pypi/types/pandas-stubs)](https://pypi.org/project/pandas-stubs/)
1213

1314
## What is it?
1415

pandas-stubs/_libs/tslibs/dtypes.pyi

Lines changed: 0 additions & 53 deletions
This file was deleted.

pandas-stubs/_libs/tslibs/nattype.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pyright: strict
12
from datetime import (
23
datetime,
34
timedelta,
@@ -11,7 +12,10 @@ from typing_extensions import (
1112
)
1213

1314
from pandas._libs.tslibs.period import Period
14-
from pandas._typing import TimeUnit
15+
from pandas._typing import (
16+
NpDtype,
17+
TimeUnit,
18+
)
1519

1620
NaT: NaTType
1721
iNaT: int
@@ -30,7 +34,7 @@ class NaTType:
3034
def asm8(self) -> np.datetime64: ...
3135
def to_datetime64(self) -> np.datetime64: ...
3236
def to_numpy(
33-
self, dtype: np.dtype | str | None = ..., copy: bool = ...
37+
self, dtype: NpDtype | None = ..., copy: bool = ...
3438
) -> np.datetime64 | np.timedelta64: ...
3539
@property
3640
def is_leap_year(self) -> bool: ...
@@ -67,8 +71,8 @@ class NaTType:
6771
def weekday(self) -> float: ...
6872
def isoweekday(self) -> float: ...
6973
def total_seconds(self) -> float: ...
70-
def today(self, *args, **kwargs) -> NaTType: ...
71-
def now(self, *args, **kwargs) -> NaTType: ...
74+
def today(self, tz: _tzinfo | str | None = ...) -> NaTType: ...
75+
def now(self, tz: _tzinfo | str | None = ...) -> NaTType: ...
7276
def to_pydatetime(self) -> NaTType: ...
7377
def date(self) -> NaTType: ...
7478
def round(self) -> NaTType: ...

pandas-stubs/_libs/tslibs/tzconversion.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

pandas-stubs/_libs/tslibs/vectorized.pyi

Lines changed: 0 additions & 17 deletions
This file was deleted.

pandas-stubs/core/arrays/__init__.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ from pandas.core.arrays.datetimes import DatetimeArray as DatetimeArray
99
from pandas.core.arrays.integer import IntegerArray as IntegerArray
1010
from pandas.core.arrays.interval import IntervalArray as IntervalArray
1111
from pandas.core.arrays.numpy_ import PandasArray as PandasArray
12-
from pandas.core.arrays.period import (
13-
PeriodArray as PeriodArray,
14-
period_array as period_array,
15-
)
12+
from pandas.core.arrays.period import PeriodArray as PeriodArray
1613
from pandas.core.arrays.sparse import SparseArray as SparseArray
1714
from pandas.core.arrays.string_ import StringArray as StringArray
1815
from pandas.core.arrays.timedeltas import TimedeltaArray as TimedeltaArray

pandas-stubs/core/arrays/period.pyi

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from collections.abc import Sequence
2-
31
import numpy as np
42
from pandas import PeriodDtype
53
from pandas.core.arrays.datetimelike import (
@@ -10,8 +8,6 @@ from pandas.core.arrays.datetimelike import (
108
from pandas._libs.tslibs import Timestamp
119
from pandas._libs.tslibs.period import Period
1210

13-
from pandas.tseries.offsets import Tick
14-
1511
class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps):
1612
__array_priority__: int = ...
1713
def __init__(self, values, freq=..., dtype=..., copy: bool = ...) -> None: ...
@@ -44,12 +40,3 @@ class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps):
4440
def to_timestamp(self, freq: str | None = ..., how: str = ...) -> Timestamp: ...
4541
def asfreq(self, freq: str | None = ..., how: str = ...) -> Period: ...
4642
def astype(self, dtype, copy: bool = ...): ...
47-
48-
def raise_on_incompatible(left, right): ...
49-
def period_array(
50-
data: Sequence[Period | None],
51-
freq: str | Tick | None = ...,
52-
copy: bool = ...,
53-
) -> PeriodArray: ...
54-
def validate_dtype_freq(dtype, freq): ...
55-
def dt64arr_to_periodarr(data, freq, tz=...): ...

pandas-stubs/core/indexes/base.pyi

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ from typing import (
1313
Any,
1414
ClassVar,
1515
Literal,
16+
TypeAlias,
1617
final,
1718
overload,
1819
)
@@ -263,7 +264,16 @@ class Index(IndexOpsMixin[S1]):
263264
@property
264265
def str(
265266
self,
266-
) -> StringMethods[Self, MultiIndex, np_ndarray_bool, Index[list[str]]]: ...
267+
) -> StringMethods[
268+
Self,
269+
MultiIndex,
270+
np_ndarray_bool,
271+
Index[list[str]],
272+
Index[int],
273+
Index[bytes],
274+
Index[str],
275+
Index[type[object]],
276+
]: ...
267277
def is_(self, other) -> bool: ...
268278
def __len__(self) -> int: ...
269279
def __array__(self, dtype=...) -> np.ndarray: ...
@@ -455,6 +465,8 @@ class Index(IndexOpsMixin[S1]):
455465
),
456466
) -> Self: ...
457467

468+
UnknownIndex: TypeAlias = Index[Any]
469+
458470
def ensure_index_from_sequences(
459471
sequences: Sequence[Sequence[Dtype]], names: list[str] = ...
460472
) -> Index: ...

pandas-stubs/core/series.pyi

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,16 @@ class Series(IndexOpsMixin[S1], NDFrame):
11791179
@property
11801180
def str(
11811181
self,
1182-
) -> StringMethods[Series, DataFrame, Series[bool], Series[list[str]]]: ...
1182+
) -> StringMethods[
1183+
Self,
1184+
DataFrame,
1185+
Series[bool],
1186+
Series[list[str]],
1187+
Series[int],
1188+
Series[bytes],
1189+
Series[str],
1190+
Series[type[object]],
1191+
]: ...
11831192
@property
11841193
def dt(self) -> CombinedDatetimelikeProperties: ...
11851194
@property
@@ -2318,3 +2327,5 @@ class IntervalSeries(Series[Interval[_OrderableT]], Generic[_OrderableT]):
23182327
@property
23192328
def array(self) -> IntervalArray: ...
23202329
def diff(self, periods: int = ...) -> Never: ...
2330+
2331+
UnknownSeries: TypeAlias = Series[Any]

0 commit comments

Comments
 (0)