8000 BUG: Added type annotations in fit method. by proenca555 · Pull Request #28610 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Added type annotations in fit method. #28610

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

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 16 additions & 3 deletions numpy/polynomial/_polybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import os
import abc
import numbers
from typing import Callable
from typing import Callable, Optional, Union, List, Tuple, Any, Type, TypeVar

import numpy as np
from numpy import ndarray, dtype
from . import polyutils as pu

__all__ = ['ABCPolyBase']

T = TypeVar("T", bound="ABCPolyBase")

class ABCPolyBase(abc.ABC):
"""An abstract base class for immutable series classes.

Expand Down Expand Up @@ -946,8 +949,18 @@ def linspace(self, n=100, domain=None):
return x, y

@classmethod
def fit(cls, x, y, deg, domain=None, rcond=None, full=False, w=None,
window=None, symbol='x'):
def fit(
cls: Type[T],
x: ndarray[Any, dtype[np.float64]],
y: ndarray[Any, dtype[np.float64]],
deg: Union[int, ndarray[Any, dtype[np.int_]]],
domain: Optional[Union[List[float], None]] = None,
rcond: Optional[float] = None,
full: bool = False,
w: Optional[ndarray[Any, dtype[np.float64]]] = None,
window: Optional[Union[List[float], None]] = None,
symbol: str = 'x'
) -> Union[T, Tuple[T, Any]]:
"""Least squares fit to data.

Return a series instance that is the least squares fit to the data
Expand Down
Loading
0