'dataframe reparsing new columns in a loop

My dataframe is suppose to just create 1 modified copy of each int or float value column however it is modifying the modified column etc. I believe when I write for column in data, it thinks there are more columns than are actually present. Is their any way to fix this problem? error occurs at ** here is what is appearing enter image description here

class simple_math:
    def __init__(self, operand, operator):
        self.operand=operand
        self.operator=operator
        if self.operator == '+' or self.operator=='-' or self.operator=='/':
            print('this is correct character')
        else:
            print('You have entered the wrong character')
            
    def user_op(self, user_input):
        operand=self.operand
        operator=self.operator
        temp = operand
        if operator == '+':
            temp += user_input
            return temp
        if operator == '-':
            temp -= user_input
            return temp
        if operator == '/':
            temp /= user_input
            return temp
test_data=sns.load_dataset('titanic')
df=test_data
df2=pd.DataFrame()
i = 0
for columns in df:
    new_columns= []
    if df[columns].dtypes == float or df[columns].dtypes == bool:
        new_columns = df[columns]
        df2.insert(i, columns, new_columns)
        i=i+1
    else:
        pass
df2= df2.replace({True: 'TRUE', False: 'FALSE'})
df3 = df2.loc[df['fare']<70] 
test_data = df3.dropna()
test_data
**class tester(simple_math):
    def applicator(self, data):
        data.reset_index(drop=True, inplace=True)
        df = data
        for columns in data:
            try: 
                df['modified_%s' % columns]= simple_math.user_op(self, data[columns])
            except: 
                print('unable to parse', columns)
                pass
        return df


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source