Open
Description
As per this question on SO:
I have the following example dataframe:
df = pd.DataFrame({'a': ['example']})
I can run any of the following without any problems:
df[df['a'].str.slice(0,6).str.contains("e")] # Works
df.query('a.str.slice(0,6).str.contains("e")') # Works - same output as above
df[df['a'].str.slice(0,-1).str.contains("e")] # Works
But not this:
df.query('a.str.slice(0,-1).str.contains("e")') # Generates an exception!
I get quite a long error message, terminating with
AttributeError: 'UnaryOp' object has no attribute 'value'
Is this perhaps a bug or known issue with Pandas when using the query syntax? I am using Pandas 1.5.1 and python 3.9.7.