How to get the max/min value in Pandas DataFrame when nan value in it

前端 未结 6 937
萌比男神i
萌比男神i 2021-01-01 19:07

Since one column of my pandas dataframe has nan value, so when I want to get the max value of that column, it just return error.

>>> d         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-01 20:05

    You can set numeric_only = True when calling max:

    df.iloc[:, 1].max(numeric_only = True)
    

提交回复
热议问题