Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print(data.isnull().sum())# почти 10% от всех данных не учтены - выбрасывать нельзя, поэтому заменим на среднее
- data['days_employed']=data['days_employed'].abs()
- def median_for_all (dataframe, inc_type):
- dataframe.loc[dataframe[['days_employed', 'total_income','income_type']]['income_type']=='inc_type'] = dataframe.loc[dataframe[['days_employed', 'total_income','income_type']]['income_type']=='inc_type'].fillna(data[['days_employed', 'total_income']].median())
- return dataframe.loc[dataframe[['days_employed', 'total_income','income_type']]['income_type']=='inc_type']
- #print(data.loc[data[['days_employed', 'total_income','income_type']]['income_type']=='сотрудник'].isnull().sum())
- median_for_all(data,'сотрудник')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement