You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can refer to column names that contain spaces or operators by surrounding them in backticks. This way you can also escape names that start with a digit, or those that are a Python keyword. Basically when it is not valid Python identifier. See notes down for more details.
However, the notes that follow indicate:
Python keywords may not be used as identifiers.
So the first part suggests Python keywords can be used, while the second part indicates they cannot. Testing suggests they cannot currently be used.
Suggested fix for documentation
Change the expr description to read:
You can refer to column names that are not valid Python variable names by surrounding them in backticks. Thus column names containing spaces or punctuation (besides underscores) or starting with digits must be surrounded by backticks. (For example, a column named "Area (cm^2)" would be referenced as Area (cm^2).) Column names which are Python keywords (like "list", "for", "import", etc) cannot be used.
The text was updated successfully, but these errors were encountered:
Location of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query
Documentation problem
The
expr
parameter is described as follows:However, the notes that follow indicate:
So the first part suggests Python keywords can be used, while the second part indicates they cannot. Testing suggests they cannot currently be used.
Suggested fix for documentation
Change the
expr
description to read:The text was updated successfully, but these errors were encountered: