done
This commit is contained in:
		| @ -0,0 +1,119 @@ | ||||
| from collections.abc import Sequence | ||||
| from datetime import ( | ||||
|     date, | ||||
|     datetime, | ||||
| ) | ||||
| from typing import ( | ||||
|     Literal, | ||||
|     TypedDict, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| import numpy as np | ||||
| from pandas import ( | ||||
|     Index, | ||||
|     Timestamp, | ||||
| ) | ||||
| from pandas.core.arrays import ExtensionArray | ||||
| from pandas.core.indexes.datetimes import DatetimeIndex | ||||
| from pandas.core.series import ( | ||||
|     Series, | ||||
|     TimestampSeries, | ||||
| ) | ||||
| from typing_extensions import TypeAlias | ||||
|  | ||||
| from pandas._libs.tslibs import NaTType | ||||
| from pandas._typing import ( | ||||
|     AnyArrayLike, | ||||
|     DictConvertible, | ||||
|     IgnoreRaise, | ||||
|     RaiseCoerce, | ||||
|     TimestampConvertibleTypes, | ||||
|     npt, | ||||
| ) | ||||
|  | ||||
| ArrayConvertible: TypeAlias = list | tuple | AnyArrayLike | ||||
| Scalar: TypeAlias = float | str | ||||
| DatetimeScalar: TypeAlias = Scalar | datetime | np.datetime64 | date | ||||
|  | ||||
| DatetimeScalarOrArrayConvertible: TypeAlias = DatetimeScalar | ArrayConvertible | ||||
|  | ||||
| DatetimeDictArg: TypeAlias = list[Scalar] | tuple[Scalar, ...] | AnyArrayLike | ||||
|  | ||||
| class YearMonthDayDict(TypedDict, total=True): | ||||
|     year: DatetimeDictArg | ||||
|     month: DatetimeDictArg | ||||
|     day: DatetimeDictArg | ||||
|  | ||||
| class FulldatetimeDict(YearMonthDayDict, total=False): | ||||
|     hour: DatetimeDictArg | ||||
|     hours: DatetimeDictArg | ||||
|     minute: DatetimeDictArg | ||||
|     minutes: DatetimeDictArg | ||||
|     second: DatetimeDictArg | ||||
|     seconds: DatetimeDictArg | ||||
|     ms: DatetimeDictArg | ||||
|     us: DatetimeDictArg | ||||
|     ns: DatetimeDictArg | ||||
|  | ||||
| @overload | ||||
| def to_datetime( | ||||
|     arg: DatetimeScalar, | ||||
|     errors: IgnoreRaise = ..., | ||||
|     dayfirst: bool = ..., | ||||
|     yearfirst: bool = ..., | ||||
|     utc: bool = ..., | ||||
|     format: str | None = ..., | ||||
|     exact: bool = ..., | ||||
|     unit: str | None = ..., | ||||
|     origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., | ||||
|     cache: bool = ..., | ||||
| ) -> Timestamp: ... | ||||
| @overload | ||||
| def to_datetime( | ||||
|     arg: DatetimeScalar, | ||||
|     errors: Literal["coerce"], | ||||
|     dayfirst: bool = ..., | ||||
|     yearfirst: bool = ..., | ||||
|     utc: bool = ..., | ||||
|     format: str | None = ..., | ||||
|     exact: bool = ..., | ||||
|     unit: str | None = ..., | ||||
|     origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., | ||||
|     cache: bool = ..., | ||||
| ) -> Timestamp | NaTType: ... | ||||
| @overload | ||||
| def to_datetime( | ||||
|     arg: Series | DictConvertible, | ||||
|     errors: RaiseCoerce = ..., | ||||
|     dayfirst: bool = ..., | ||||
|     yearfirst: bool = ..., | ||||
|     utc: bool = ..., | ||||
|     format: str | None = ..., | ||||
|     exact: bool = ..., | ||||
|     unit: str | None = ..., | ||||
|     origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., | ||||
|     cache: bool = ..., | ||||
| ) -> TimestampSeries: ... | ||||
| @overload | ||||
| def to_datetime( | ||||
|     arg: ( | ||||
|         Sequence[float | date] | ||||
|         | list[str] | ||||
|         | tuple[float | str | date, ...] | ||||
|         | npt.NDArray[np.datetime64] | ||||
|         | npt.NDArray[np.str_] | ||||
|         | npt.NDArray[np.int_] | ||||
|         | Index | ||||
|         | ExtensionArray | ||||
|     ), | ||||
|     errors: RaiseCoerce = ..., | ||||
|     dayfirst: bool = ..., | ||||
|     yearfirst: bool = ..., | ||||
|     utc: bool = ..., | ||||
|     format: str | None = ..., | ||||
|     exact: bool = ..., | ||||
|     unit: str | None = ..., | ||||
|     origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., | ||||
|     cache: bool = ..., | ||||
| ) -> DatetimeIndex: ... | ||||
| @ -0,0 +1,40 @@ | ||||
| from typing import ( | ||||
|     Literal, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| import numpy as np | ||||
| import pandas as pd | ||||
| from typing_extensions import TypeAlias | ||||
|  | ||||
| from pandas._libs.lib import _NoDefaultDoNotUse | ||||
| from pandas._typing import ( | ||||
|     DtypeBackend, | ||||
|     RaiseCoerce, | ||||
|     Scalar, | ||||
|     npt, | ||||
| ) | ||||
|  | ||||
| _Downcast: TypeAlias = Literal["integer", "signed", "unsigned", "float"] | None | ||||
|  | ||||
| @overload | ||||
| def to_numeric( | ||||
|     arg: Scalar, | ||||
|     errors: Literal["raise", "coerce"] = ..., | ||||
|     downcast: _Downcast = ..., | ||||
|     dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., | ||||
| ) -> float: ... | ||||
| @overload | ||||
| def to_numeric( | ||||
|     arg: list | tuple | np.ndarray, | ||||
|     errors: RaiseCoerce = ..., | ||||
|     downcast: _Downcast = ..., | ||||
|     dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., | ||||
| ) -> npt.NDArray: ... | ||||
| @overload | ||||
| def to_numeric( | ||||
|     arg: pd.Series, | ||||
|     errors: RaiseCoerce = ..., | ||||
|     downcast: _Downcast = ..., | ||||
|     dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., | ||||
| ) -> pd.Series: ... | ||||
| @ -0,0 +1,44 @@ | ||||
| from collections.abc import Sequence | ||||
| from datetime import timedelta | ||||
| from typing import overload | ||||
|  | ||||
| from pandas import Index | ||||
| from pandas.core.indexes.timedeltas import TimedeltaIndex | ||||
| from pandas.core.series import ( | ||||
|     Series, | ||||
|     TimedeltaSeries, | ||||
| ) | ||||
|  | ||||
| from pandas._libs.tslibs import Timedelta | ||||
| from pandas._libs.tslibs.timedeltas import TimeDeltaUnitChoices | ||||
| from pandas._typing import ( | ||||
|     ArrayLike, | ||||
|     RaiseCoerce, | ||||
|     SequenceNotStr, | ||||
| ) | ||||
|  | ||||
| @overload | ||||
| def to_timedelta( | ||||
|     arg: str | float | timedelta, | ||||
|     unit: TimeDeltaUnitChoices | None = ..., | ||||
|     errors: RaiseCoerce = ..., | ||||
| ) -> Timedelta: ... | ||||
| @overload | ||||
| def to_timedelta( | ||||
|     arg: Series, | ||||
|     unit: TimeDeltaUnitChoices | None = ..., | ||||
|     errors: RaiseCoerce = ..., | ||||
| ) -> TimedeltaSeries: ... | ||||
| @overload | ||||
| def to_timedelta( | ||||
|     arg: ( | ||||
|         SequenceNotStr | ||||
|         | Sequence[float | timedelta] | ||||
|         | tuple[str | float | timedelta, ...] | ||||
|         | range | ||||
|         | ArrayLike | ||||
|         | Index | ||||
|     ), | ||||
|     unit: TimeDeltaUnitChoices | None = ..., | ||||
|     errors: RaiseCoerce = ..., | ||||
| ) -> TimedeltaIndex: ... | ||||
		Reference in New Issue
	
	Block a user