Let's say I have 2 pivot tables: dfp1 and dfp2.
My current code is:
if not dfp2.empty:
for key in dfp1['col1'].keys():
if key not in dfp2['col2'].keys():
dfp2['col2'][key] = 0
The purpose is to check if a value exist in col1 of dfp1 exists in col2 of dfp2. If not, make it 0.
However this does not add the value to dfp2['col2']. How should I go to add this 0 value?
Thanks in advance.
Edit:
Some sample data:
dfp1['col1']
*Currency Code
CNH 0.00
INR 0.00
JPY -985718.00
SGD -70.69
USD 9103.94
dfp2['col2']
JPY 8030442.00
MYR 153050.00
SGD 636836.44
USD 553863.09
Expected output for dfp2['col2']:
JPY 8030442.00
MYR 153050.00
SGD 636836.44
USD 553863.09
CNH 0.00
INR 0.00