my dataset
data={'A':['1210226','1210226','1210226','1210302','1210336','1210336','1210336'],'B':['','','2@.com','1@.com,'','','1@.com']}
df=pd.DataFrame(data)
print(df)
i filter the column to blanks in excel == python( used is.null)
Data set in excel
The condition I want to apply in pandas is =IF(A1=A3,B3,"") Formula is written in excel ( please review the image), and sheet is filtered with blanks. i know i have to use is.null() then i want to apply condition to the is.null in order to get required output.
Final output should be something like below image
excel condition: if(logic_test, [value_if_true],[value_if_false]) condition i use: =IF(A1=A3,B3,"") output: I would like to replace the 'Activity_Mailbox' nan value with condition= if Ticket_id(row1)==Ticket_id(row2) print value of activity_mailbox(row2) else empty/""/blank.
actual data:
data= {'Activity_Mailbox': {0: nan,
1: 'enqsy@wrup.com.au',
2: nan,
3: nan,
4: nan,
5: 'enqsy@wrup.com.au',
6: 'enqsy@wrup.com.au',
7: 'enqsy@wrup.com.au',
8: 'enqsy@wrup.com.au',
9: 'enqsy@wrup.com.au'},
'Activity_Source': {0: 'Email',
1: 'Email',
2: 'Email',
3: 'Email',
4: 'Email',
5: 'Email',
6: 'Email',
7: 'Email',
8: 'Email',
9: 'Email'},
'Activity_Type': {0: 'status change',
1: 'Emailbox_used change',
2: 'status change',
3: 'status change',
4: 'status change',
5: 'email response',
6: 'email response',
7: 'status change',
8: 'status change',
9: 'status change'},
'EmailDateTime': {0: '13/01/2001 23:52',
1: '13/01/2001 23:34',
2: '13/01/2001 23:34',
3: '13/01/2001 23:25',
4: '13/01/2001 23:13',
5: '13/01/2001 9:42',
6: '13/01/2001 9:29',
7: '13/01/2001 9:29',
8: '13/01/2001 9:29',
9: '13/01/2001 9:29'},
'Initial_Channel': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: 'Email',
6: 'Email',
7: 'Email',
8: 'Email',
9: 'Email'},
'Spam': {0: True,
1: nan,
2: nan,
3: True,
4: nan,
5: nan,
6: nan,
7: nan,
8: nan,
9: nan},
'Status': {0: 'Open',
1: nan,
2: 'Open',
3: 'Open',
4: 'Open',
5: nan,
6: nan,
7: 'Resolved',
8: 'Closed',
9: 'Resolved - Awaiting Survey'},
'Subject': {0: nan,
1: 'Re: TROUBLESHOOTING',
2: 'Re: TROUBLESHOOTING',
3: nan,
4: '[EXT]: EMNAT PTY LTD T/As Get Real Purchase Order 00010',
5: 'Uniform',
6: 'Uniform',
7: 'Uniform',
8: 'Uniform',
9: 'Uniform'},
'TaskOwner': {0: 'user',
1: 'system',
2: 'clt',
3: 'user',
4: 'clt',
5: 'clt',
6: 'at',
7: 'at',
8: 'system',
9: 'system'},
'TaskOwnerName': {0: 'user',
1: 'system',
2: 'Ea.tr',
3: 'usr',
4: 'Nce',
5: 'Enrnes',
6: 'Royapin',
7: 'Roapin',
8: 'syem',
9: 'syem'},
'Transaction_Processed': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: '1',
6: '1',
7: '1',
8: '1',
9: '1'},
'Transaction_Requested': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: '1',
6: '1',
7: '1',
8: '1',
9: '1'},
'bcc_emails': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: nan,
6: nan,
7: nan,
8: nan,
9: nan},
'cc_emails': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: nan,
6: nan,
7: nan,
8: nan,
9: nan},
'ticket_id': {0: 12157,
1: 12157,
2: 12157,
3: 12157,
4: 12157,
5: 13774,
6: 13774,
7: 13774,
8: 13774,
9: 13774},
'to_emails': {0: nan,
1: nan,
2: nan,
3: nan,
4: nan,
5: 'Wr up Enqs enqsy@wrup.com.au',
6: 'en.libarnes@gmail.com',
7: nan,
8: nan,
9: nan}}