I want to construct a condition for my dataframe in a function by iterating through the given dictionary dict.
def get_condition(dataframe, dict={'col1':val1, 'col2':val2, 'col3':val3})":
condition = ...
return condition
Expected output
condition = (dataframe['col1']==val1) & (dataframe['col2']==val2) & (dataframe['col3']==val3)
How to do this?
dictas the variable name for your dictionary, you're overwriting the builtin dict type/function, which should generally be avoided if possible.