I have a function into which I pass variables. I do not change the names of the variables.
I expect the variable inside the function to be treated as a local variable but in several instances it appears to actually change the variable of the same name outside the function. I don't think this should be happening. Anyone experienced it?
So, I have this:
def(df1,df2,df3)
df1.set_index('A',inplace=True)
df2['c'] = df1['B'] * df3['G']
return df2
I am finding that df1.set_index('A',inplace=True)
is changing df1
outside the function. So when I call the function again I get an error because the function doesn't "see" df1['A'] in df1. It sees df1 passed from the "outside" as having the index set to 'A' already in an earlier call.
Anyone get this kind of memory bleed?