lfit¶
-
hhpy.ds.lfit(x: Union[pandas.core.series.Series, str], y: Union[pandas.core.series.Series, str] = None, w: Union[pandas.core.series.Series, str] = None, df: pandas.core.frame.DataFrame = None, groupby: Union[list, str] = None, do_print: bool = True, catch_error: bool = False, return_df: bool = False, extrapolate: bool = None)[source]¶ quick linear fit with numpy
Parameters: - x – names of x variables in df or vector data, if y is None treated as target and fit against the index
- y – names of y variables in df or vector data [optional]
- w – names of weight variables in df or vector data [optional]
- df – pandas DataFrame containing x,y,w data [optional]
- groupby – If specified the linear fit is applied by group [optional]
- do_print – whether to print steps to console
- catch_error – whether to keep going in case of error [optional]
- return_df – whether to return a DataFrame or Series [optional]
- extrapolate – how many iteration to extrapolate [optional]
Returns: if return_df is True: pandas DataFrame, else: pandas Series