import pandas
df = pandas.DataFrame({'ColName / WithFrontSlash': [1, 2]})
df['ColName / WithFrontSlash']

0    1
1    2
Name: ColName / WithFrontSlash, dtype: int64

#this output is what is exptected
df.query('ColName / WithFrontSlash > 1')
pandas.computation.ops.UndefinedVariableError: name 'ColName' is not defined

Pandas version is 0.17.1

Comment From: jorisvandenbossche

Currently you can only refer to column names in query that have no spaces or other special characters. See https://github.com/pydata/pandas/issues/6508 for an enhancement request to make this possible.

For now, if you want to use query, you will have to rename the columns. But most usage of query can also be done in other (possibly less performant) ways; in this case: df[df['ColName / WithFrontSlash'] > 1]