I have such a data frame
import pandas as pd
sample_df = pd.DataFrame({'ID': [25,25,25,18,18,18],
'AGE': [11,11,12,11,12,13],
'RECORD':[1,2,2,1,1,2]})
| ID | AGE | RECORD |
|---|---|---|
| 25 | 11 | 1 |
| 25 | 11 | 2 |
| 25 | 12 | 2 |
| 18 | 11 | 1 |
| 18 | 12 | 1 |
| 18 | 13 | 2 |
I would like to plot number of profiles vs age given this dataframe. My expectation is to have a plot for each age, for example age 11, there should be 3 profiles. Or for age 12, there should be 2 profiles. I tried using df.query, but I ended up confusing. Could you help me?
Expected output should look like below. Legend is not necessary for each ID


