I have a dataframe:
login Status start
0 2021-05-28 09:29:35 Resolved NaT
1 2021-05-28 11:46:11 Closed NaT
2 2021-05-29 15:59:16 WIP NaT
3 2021-05-30 10:43:57 Closed 2021-05-31 12:53:57
4 2021-06-27 17:53:29 Resolved NaT
I want to fill start value with login value if start is NULL and Status is either Resolved or Closed.
Expected DataFrame:
login Status start
0 2021-05-28 09:29:35 Resolved 2021-05-28 09:29:35
1 2021-05-28 11:46:11 Closed 2021-05-28 11:46:11
2 2021-05-29 15:59:16 WIP NaT
3 2021-05-30 10:43:57 Closed 2021-05-31 12:53:57
4 2021-06-27 17:53:29 Resolved 2021-06-27 17:53:29
iam unable to put condition for Null start values
I tried to make a function :
def fun(row):
if row.start.isna() and (row['Status'] == 'Resolved') or (row['Status' == 'Closed']):
return row['start']
else:
return row['login']
and then using apply to run the function:
df['start'] = df.apply(fun, axis=1)
But iam getting error :
AttributeError: 'Timestamp' object has no attribute 'isna'
How can we get the above result
TIA
.isnull()rather than.isna()?