I have the following code
import pandas as pd
df = pd.DataFrame(columns=['var1', 'var2','var3'])
df.loc[0] = [0,1,2]
def RS():
x = 123
y = 456
z = 'And some more random shit'
return x+y
def BS():
x = -890
y = (456*1)+90
z = 'And some more random shit'
return x-y
def MyCompute(srt, srt_string):
df[srt_string] = srt()
df['1min' + srt_string] = 1-df[srt_string]
MyCompute(srt=RS, srt_string='RS')
MyCompute(srt=BS, srt_string='BS')
Is there a way to avoid the double RS and double BS in calling the MyCompute function?