I would like to illustrate the change in one variable for several persons in my data over time. I have several issues with basic commands here.
Here is my data:
import pandas as pd
df = pd.DataFrame({'year': ['1988', '1989', '1990', '1988', '1989', '1990', '1988', '1989', '1990'],
'id': ['1', '1', '1', '2', '2', '2', '3', '3', '3'],
'money': ['5', '7', '8', '8', '3', '3', '7', '8', '10']}).astype(int)
df.info()
df
I tried to make use of matplotlib and started to loop for each of my unique IDs. I'm new to this package. First, how can I specify for each plot that only 3 points are connected for a line, not all? Second, how can I overlay those plots in one figure?
import matplotlib.pyplot as plt
for i in df.id.unique():
df.plot.line(x='year', y='money')



