I have a dataset with two columns. One column is dates and the second is a multiple metric. I want to create a third column (New_Col) that looks at the current multiple and the previously created value and multiply them. So the first one would
Date Multiple
01-01-2020 1
01-01-2020 1
01-01-2020 3
01-01-2020 1
01-01-2020 1
01-01-2020 1
01-01-2020 4
01-01-2020 1
Function:
def new_func(df):
Output
Date Multiple New_Col
01-01-2020 1 1
01-01-2020 1 1
01-01-2020 3 3
01-01-2020 1 3
01-01-2020 1 3
01-01-2020 1 3
01-01-2020 4 12
01-01-2020 1 12
Aucun commentaire:
Enregistrer un commentaire