Query vs Eval: Preventing Stale pandas Results
Background When repeatedly executing DataFrame.query on the same DataFrame, pandas compiles the query string into a numexpr expression and caches the compiled Abstract Syntax Tree (AST). The cache is keyed solely on the query string, not on the underlying data. Consequently, if the DataFrame is mutated after the first evaluation, subsequent query calls may r