Skip to content

String comparison in query() #6155

Closed
@michaelbilow

Description

@michaelbilow

Hi, it seems that string comparisons aren't supported in query() yet, so maybe this isn't a bug yet. Anyway, hopefully this behavior will be fixed for future editions of pandas.

import pandas as pd
import numexpr as ne

a = list('abcdef')
b = range(6)
df = pd.DataFrame({'X':pd.Series(a),'Y': pd.Series(b)})

df_Y = df.query('Y < 3')             ## Works fine.
ne_works = ne.evaluate('"a" < "d"')  ## ne_works == np.array([True])
df_X = df.query('X < "d"')           ## RuntimeError: max recursion depth exceeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions