After performing calculations on an entire pandas dataframe, I need to go back and override variable calculations (often setting to zero) based on the value of another variable(s). Is there a more succinct/idiomatic way to perform this kind of operation?
df['var1000'][df['type']==7] = 0
df['var1001'][df['type']==7] = 0
df['var1002'][df['type']==7] = 0
...
df['var1099'][df['type']==7] = 0
Is there a pandas-y way to do something like this?
if (df['type']==7):
df['var1000'] = 0
df['var1001'] = 0
df['var1002'] = 0
...
df['var1099'] = 0