I have a dataframe with two columns, Date and Name. I want to search for a specific name and get the different Dates on which that name occurs. Then, I only want to keep those rows that have those dates. This is my data:
| Meeting Dates | Name |
|---|---|
| 1746-06-02 | Sa Majesté (#p32) |
| 1746-06-02 | Maupertuis (#p4) |
| 1746-06-02 | Jordan (#p31) |
| 1746-06-09 | Maupertuis (#p4) |
| 1746-06-09 | Voltaire (#p37) |
| 1746-06-09 | de la Condamine (#p38) |
| 1746-06-09 | Süssmilch (#p16) |
| 1746-06-09 | Sa Majesté (#p32) |
| 1746-06-09 | Formey (#p27) |
| 1746-06-16 | Marggraf (#p20) |
| 1746-06-23 | Dohna (#p39) |
| 1746-06-23 | Euler (#p10) |
I have used the following code to find all occurrences of my name:
df["Name"].value_counts()["Sa Majesté (#p32)"]
I know what to store the corresponding dates but I am unsure how. Once I have those dates, I plan to store the values and filter through my original dataframe and keep only those rows with those dates.
I would really appreciate any help/pointers with this.