比如说,要根据某一列的最大值找出每个人所在的行,或者说找出每个人数学成绩最高的那一年

gjj_data_meger.groupby('reportno').apply(lambda t: t[t.gettime==t.gettime.max()])

但是要注意的是,这一些的值需要是能用max()计算出来,不然就会报错

TypeError: '>=' not supported between instances of 'str' and 'float'

我们可以先验证df.max()对应的列是否能够计算

 

相关文章:

  • 2021-12-02
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-04-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-01-19
  • 2021-08-18
相关资源
相似解决方案