小编Anu*_*wat的帖子

Pandas分组在一列上,另一列python上有最大日期

我有一个包含以下数据的数据框:

invoice_no  dealer  billing_change_previous_month        date
       110       1                              0  2016-12-31
       100       1                         -41981  2017-01-30
      5505       2                              0  2017-01-30
      5635       2                          58730  2016-12-31
Run Code Online (Sandbox Code Playgroud)

我想只有一个拥有最长日期的经销商.所需的输出应该是这样的:

invoice_no  dealer  billing_change_previous_month        date
       100       1                         -41981  2017-01-30
      5505       2                              0  2017-01-30
Run Code Online (Sandbox Code Playgroud)

每个经销商应该与最大日期不同,提前感谢您的帮助.

python-2.7 pandas

11
推荐指数
2
解决办法
4886
查看次数

标签 统计

pandas ×1

python-2.7 ×1