I am trying to input an aggregated occurrence of a columns' values, into a distinct column in the same Dataframe.
I have tried to count the dates column, and input those occurrences into a dict value, and the date as a dict key.
Then when I try to (boolean) match df["count"] = df[df[column]==my_dict.keys] the logic fails on me. I am missing the part where if true, then input my_dict.values().
The Dataframe:
Date Place_code
14 2020-04-20 282
16 2020-04-23 301
18 2020-04-22 291
20 2020-04-22 422
21 2020-04-22 422
Desired Dataframe output:
Date Occurrence Place_code
14 2020-04-20 1 282
16 2020-04-23 1 301
18 2020-04-22 3 291
20 2020-04-22 3 422
21 2020-04-22 3 422
Also forgive the title, english is not my native language.