So I have a dataset that includes dates and values, corresponding to those dates.
date value category
1951-07 199 1
1951-07 130 3
1951-07 50 5
1951-08 199 1
1951-08 50 5
1951-08 199 1
1951-09 184 2
1951-09 50 5
1951-09 13 13
Now my goal is to find the values, that repeat each month. Resulting in a frame like this:
date value category
1951-07 50 5
1951-08 50 5
1951-09 50 5
Also not regarding values that repeat inside a month, or that repeat only for a few months, but not all.
The categories do often pai with the value (like shown in the example), but sometimes they don't. So I tried doing it by category, but it didn't give me exact results.
My current approach is to filter for duplicates and then get those, that occure 12 times (as i'm searching per year). But it also gives me values, that repeat 12 sides inside a month.
df = df[df.duplicated(['value'],keep=False)]
v = df.value.value_counts()
df_12 = df[df.value.isin(v.index[v.gt(12)])]
Any help would be appreciated.