How To Use Variables Inside Query In Pandas?
I have problem quering the data frame in panda when I use variable instead of value. df2 = pd.read_csv('my.csv') query=df2.query('cc_vehicle_line==7') works fine but df2 = pd.read
Solution 1:
You should use @variable_name
with @
query=df2.query('cc_vehicle_line==@variable_name')
Post a Comment for "How To Use Variables Inside Query In Pandas?"