Pandas series mean value becomes nan value

Asked 2 years ago, Updated 2 years ago, 40 views

We are complementing the missing value of application_{train|test}.csv in the kaggle Home Credit Default Risk.
I would like to fill the following two characteristics with the average value, but mean() returns to nan.

Feature
'YEARS_BUILD_AVG'
'YEARS_BEGINEXPLUATION_AVG'

print(train['YEARS_BUILD_AVG'].mean())
>>nan

I look forward to your kind cooperation.

python pandas

2022-09-29 20:25

1 Answers

data['YEARS_BUILD_AVG'].filna(data['YEARS_BUILD_AVG'].mean())

Will it work?


2022-09-29 20:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.