python - KeyError in Pandas when passing concatenated string as key -
i have dataframe 'df' has column 'call_id' 1 of values '888'. have following variables:
c = 'call_id' v = '888' q = 'df[c] == v'
df[df[c] == v]
working fine. however, df[q]
giving me key error. suggestions ?
df[q]
looking column named 'df[c] == v'
. not equivalent df[c] == v
, since first thing string , second thing python expression.
Comments
Post a Comment