Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. print(data.isnull().sum())# почти 10% от всех данных не учтены - выбрасывать нельзя, поэтому заменим на среднее
  2. data['days_employed']=data['days_employed'].abs()
  3.  
  4. def median_for_all (dataframe, inc_type):
  5. 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())
  6. return dataframe.loc[dataframe[['days_employed', 'total_income','income_type']]['income_type']=='inc_type']
  7. #print(data.loc[data[['days_employed', 'total_income','income_type']]['income_type']=='сотрудник'].isnull().sum())
  8. median_for_all(data,'сотрудник')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement