Pandas 3.1 filter: Selecting rows with a pd.col condition Pandas 3.1 introduces a filter method that applies a row condition via pd.col, letting users replace .loc[pd.col('passenger_count') > 1, 'trip_distance'] with .filter(cond=pd.col('passenger_count') > 1)['trip_distance'], according to a November 8, 2026 post on the release. The post notes the new filter-based form is "much slower" than the equivalent .loc expression. The change gives Pandas users an alternative row-selection syntax but at a performance cost versus .loc. Pandas 3.1 filter: Selecting rows with a pd.col condition November 8, 2026 Python Python Starting with Python Pandas 3.1, use “filter” to apply a condition to rows. So: df .loc pd.col 'passenger count' 1 , 'trip distance' .mean can now be the much slower : df .filter cond=pd.col 'passenger count' 1 'trip distance' .mean ← Pandas 3.1 select method: Retrieving specific columns New course: Introduction to agentic coding with Claude Code →