In the below table I am trying to change the figures in the column "Value" if it meets the condition.
Condition: if the "Date" for Identifier A_xcxcxcis < '05/05/2021' then "Value" for both A_xcxcxc and DAB_bcbcbc (the row below it) is changed to zero, else both values remain the same (the two rows are linked to each other).
Then it will perform the same check for BAB_bnbnb, CCC_eetr, D_tyty, and so on. I have shown the expected answer to the table below.
*** Had to make some edits to the original table
New table:
import pandas as pd
df = pd.DataFrame({'IDENTIFIER': ['A_xcxcxc', 'DAB_bcbcbc', 'BAB_bnbnb', 'XYZ_ererte', 'CCC_eetr', 'CZc_rgrg', 'D_tyty', 'sdD_wewerw', 'sdE_tyty', 'Esd_fhg'],
'income': [-30362100.0, 200000.0, -21248077.5, 150000.0, -33843389.2, 200000.0, -40229279.75, 250000.0, -22111384.6, 200000.0],
'Date' : ['03/03/2021', '22/01/2060', '04/03/2021', '22/07/2068', '08/03/2021', '22/11/2065', '05/04/2021', '22/03/2052', '15/10/2025', '22/07/2065']
})
Expected answer: