Skip to content Skip to sidebar Skip to footer

Scipy Minimisation Optimisation Row-wise On Dataframe

TYPO FIXEDD I need to perform a minimization optimisation for each timestep in my timeseries. The optimisation sets the price based on values in different columns across the row an

Solution 1:

The problem is caused by an incorrect value, finance_df.apply(lambda row: row * row.DELIVERIES_R). Unlike the iterating across a row (DataSeries), iterating across a table (DataFrame) requires the axis = 1 to be specified if row-wise, namely df.apply(fun, axis=1) else you get columns (axis 0) and as the column and the error you saw.

(Response first given as comment, now converted to answer to close quickly this typo question).

Post a Comment for "Scipy Minimisation Optimisation Row-wise On Dataframe"