def _basic_math_operation(df, new_column, column_1, column_2, op):
if not isinstance(column_1, (str, int, float)):<EOL><INDENT>raise TypeError(f'<STR_LIT>')<EOL><DEDENT>if not isinstance(column_2, (str, int, float)):<EOL><INDENT>raise TypeError(f'<STR_LIT>')<EOL><DEDENT>if isinstance(column_1, str):<EOL><INDENT>column_1 = df[column_1]<EOL><DEDENT>if isinstance(column_2, str):<EOL><INDENT>column_2 = df[column_2]<EOL><DEDENT>operator = getattr(_operator, op)<EOL>df[new_column] = operator(column_1, column_2)<EOL>return df<EOL>
Basic mathematical operation to apply operator on `column_1` and `column_2`
Both can be either a number or the name of a column of `df`
Will create a new column named `new_column`