How to fill nan values with an expression
How to fill nan values with an expression please make an effort trying to help me to know how to fill nan values with a certain expression. If NaN value is True, I want to replace by the substrac of two dates to obtain the days between the dates. Table: Nan - 24/05/2017 - 25/05/2017 Nan - 24/06/2018 - 25/06/2018 35 - 10/03/2017 - 5/04/2017 I want to obtain 1 - 24/05/2017 - 25/05/2017 1 - 24/06/2018 - 25/06/2018 35 - 10/03/2017 - 5/04/2017 Please help. Im trying to do with: dfp['DIAS A ULTIMO SINIESTRO'] = dfp['DIAS A ULTIMO SINIESTRO'].fillna(value=np.where(dfp['ESTADO']==1,(dfp['FECHA_ANULACION']-dfp['FECHA_INI_VIGENCIA']).dt.days,(dfp['FECHA_FIN_VIGENCIA']-dfp['FECHA_INI_VIGENCIA']).dt.days)) But I obtain this error: ValueError: invalid fill value with a class 'numpy.ndarray' By clicking "Post Your Answer", you acknowledge that you have read ou...
