【问题标题】:given column of month and its corresponding values, How to find max value in each year?给定月份的列及其对应的值,如何找到每年的最大值?
【发布时间】:2023-03-16 19:08:02
【问题描述】:

我使用的代码如下-

df['issue_date'].value_counts(ascending= False)

and I am getting output as attached -

Dec-11   -- 2260

Nov-11  --  2223

Oct-11  --  2114

Sep-11  --  2063

...

Dec-10  --   1267

Oct-10  --  1132

Nov-10  --  1121

...

我想过滤掉 2011、2010 年的最大值,分别是 2260 和 1267 能否请教。

【问题讨论】:

标签: python python-3.x pandas dataframe sorting


【解决方案1】:

df['issue_date'].max(axis = 1, skipna = True)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    • 1970-01-01
    • 2021-01-19
    • 2019-05-28
    • 1970-01-01
    • 1970-01-01
    • 2018-01-29
    相关资源
    最近更新 更多