dimanche 17 janvier 2021

Filtering and replacing the value in dataframe

I am trying to filter the rows of a data frame according to the below conditions and want to replace the values by a new value of a column. The error I am getting is: TypeError: unsupported operand type(s) for &: 'float' and 'bool'

Kind help how can I do that. the picture of df is in link.

dataset****

data1=data.loc[data['dob_years']==0] & data.loc[data['income_type']=='retiree']
 replace value of dob_years==0 by 60.0

Aucun commentaire:

Enregistrer un commentaire