String comparison in query() · Issue #6155 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@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