pandas: filter rows of DataFrame with operator chaining

前端 未结 14 2378
悲哀的现实
悲哀的现实 2020-11-22 16:46

Most operations in pandas can be accomplished with operator chaining (groupby, aggregate, apply, etc), but the only way I

14条回答
  •  猫巷女王i
    2020-11-22 17:37

    You can also leverage the numpy library for logical operations. Its pretty fast.

    df[np.logical_and(df['A'] == 1 ,df['B'] == 6)]
    

提交回复
热议问题