Reuven M. Lerner @lernerpython.com · 27d

Filtering a #Python #Pandas data frame by the index? Pandas 3 adds pd.col, removing lambda from our .loc expression. Before: df.loc[ lambda df_: df_['x'] > df_['w'] ] Now: df.loc[ pd.col('x') > pd.col('w') ] Note: You cannot use pd.col with a series, only a data frame.

5 likes 0 replies

?