(df, filters, model_fit, ytransform=None)
return pd.Series(sim_data, index=df.index)
Apply model to new data to predict new dependent values.

    Parameters
    ----------
    df : pandas.DataFrame
    filters : list of str
        Any filters to apply before doing prediction.
    model_fit : statsmodels.regression.linear_model.OLSResults
        Result of model estimation.
    ytransform : callable, optional
        A function to call on the array of predicted output.
        For example, if the model relation is predicting the log
        of price, you might pass ``ytransform=np.exp`` so that
        the results reflect actual price.

        By default no transformation is applied.

    Returns
    -------
    result : pandas.Series
        Predicted values as a pandas Series. Will have the index of `df`
        after applying filters.
Apply model to new data to predict new dependent values.
Apply model to new data to predict new dependent values .
def predict(df, filters, model_fit, ytransform=None):
    """
    Apply model to new data to predict new dependent values.

    Parameters
    ----------
    df : pandas.DataFrame
    filters : list of str
        Any filters to apply before doing prediction.
    model_fit : statsmodels.regression.linear_model.OLSResults
        Result of model estimation.
    ytransform : callable, optional
        A function to call on the array of predicted output.
        For example, if the model relation is predicting the log
        of price, you might pass ``ytransform=np.exp`` so that
        the results reflect actual price.

        By default no transformation is applied.

    Returns
    -------
    result : pandas.Series
        Predicted values as a pandas Series. Will have the index of `df`
        after applying filters.

    """
    df = util.apply_filter_query(df, filters)

    with log_start_finish('statsmodels predict', logger):
        sim_data = model_fit.predict(df)

    if len(sim_data) != len(df):
        raise ModelEvaluationError(
            'Predicted data does not have the same length as input. '
            'This suggests there are null values in one or more of '
            'the input columns.')

    if ytransform:
        sim_data = ytransform(sim_data)
    return pd.Series(sim_data, index=df.index)
def predict ( df , filters , model_fit , ytransform = None ) : df = util . apply_filter_query ( df , filters ) with log_start_finish ( 'statsmodels predict' , logger ) : sim_data = model_fit . predict ( df ) if len ( sim_data ) != len ( df ) : raise ModelEvaluationError ( 'Predicted data does not have the same length as input. ' 'This suggests there are null values in one or more of ' 'the input columns.' ) if ytransform : sim_data = ytransform ( sim_data ) return pd . Series ( sim_data , index = df . index )