lfit

hhpy.ds.lfit(x: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co]], y: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co]] = None, w: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co]] = None, df: pandas.core.frame.DataFrame = None, groupby: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co]] = None, do_print: bool = True, catch_error: bool = False, return_df: bool = False, extrapolate: int = None) → Union[pandas.core.series.Series, pandas.core.frame.DataFrame][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