0

Please advise on how to select the second max date in df rows.

I have a df like this:

ID   Count   DDate1  DDate2 DDate3 DDate4 DDate5

Columns with ddate are converted to datetime. The max value I have found in this way:

cols_1 = df_deal_employee.columns[2:6]
df['max_date'] = df[cols_1].max(1)

But can I create a column with the following max date? (second largest).

richardec
  • 14,202
  • 6
  • 23
  • 49

0 Answers0