I have a df that looks like this:
Name Letter Period Amount
123 H PRE 11
123 H PRE 14
123 H PRE 12
123 H DURING 5
123 H POST 100
456 H PRE 9
456 H DURING 50
456 H POST 600
789 J PRE 8
789 J PRE 17
789 J PRE 11
789 J DURING 9
789 J POST 201
789 J POST 202
789 J POST 200
I need to be able to remove values from Name where the count of PRE is not >=3 or POST is not >=3. This would mean that only Name 789 would exist after applying this logic to the df above. 123 has 3 PRE periods but only 1 POST so it is not included.
Expected output:
Name Letter Period Amount
789 J PRE 8
789 J PRE 17
789 J PRE 11
789 J DURING 9
789 J POST 201
789 J POST 202
789 J POST 200