def _golden_sect_DataFrame(params, VL, VH, func):
df = params<EOL>df['<STR_LIT>'] = VH<EOL>df['<STR_LIT>'] = VL<EOL>errflag = True<EOL>iterations = <NUM_LIT:0><EOL>while errflag:<EOL><INDENT>phi = (np.sqrt(<NUM_LIT:5>)-<NUM_LIT:1>)/<NUM_LIT:2>*(df['<STR_LIT>']-df['<STR_LIT>'])<EOL>df['<STR_LIT>'] = df['<STR_LIT>'] + phi<EOL>df['<STR_LIT>'] = df['<STR_LIT>'] - phi<EOL>df['<STR_LIT>'] = func(df, '<STR_LIT>')<EOL>df['<STR_LIT>'] = func(df, '<STR_LIT>')<EOL>df['<STR_LIT>'] = df['<STR_LIT>'] > df['<STR_LIT>']<EOL>df['<STR_LIT>'] = df['<STR_LIT>']*df['<STR_LIT>'] + df['<STR_LIT>']*(~df['<STR_LIT>'])<EOL>df['<STR_LIT>'] = df['<STR_LIT>']*~df['<STR_LIT>'] + df['<STR_LIT>']*(df['<STR_LIT>'])<EOL>err = df['<STR_LIT>'] - df['<STR_LIT>']<EOL>try:<EOL><INDENT>errflag = (abs(err) > <NUM_LIT>).any()<EOL><DEDENT>except ValueError:<EOL><INDENT>errflag = (abs(err) > <NUM_LIT>)<EOL><DEDENT>iterations += <NUM_LIT:1><EOL>if iterations > <NUM_LIT:50>:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT><DEDENT>return func(df, '<STR_LIT>'), df['<STR_LIT>']<EOL>
Vectorized golden section search for finding MPP from a dataframe
timeseries.

Parameters
----------
params : dict
    Dictionary containing scalars or arrays
    of inputs to the function to be optimized.
    Each row should represent an independent optimization.

VL: float
    Lower bound of the optimization

VH: float
    Upper bound of the optimization

func: function
    Function to be optimized must be in the form f(array-like, x)

Returns
-------
func(df,'V1') : DataFrame
    function evaluated at the optimal point

df['V1']: Dataframe
    Dataframe of optimal points

Notes
-----
This function will find the MAXIMUM of a function