Reputation: 311
I have some data where time is grouped in decimal years, sampled at 0.02, so 50 samples per year.
I want to extract the data for each year and plot them on top of each other.
I've created a dictionary for each year by using integers:
Year = df['DATE'].astype(int) # converts dates to years by integer
dfs = dict(tuple(df.groupby('Year')))
I'm now stuck how I would go about plotting a line for a third variable that changes with time (DATE) variable. What I basically want is a plot where y=variable and the x range is 50 samples (each year) and all years are plotted on top of each other.
Upvotes: 0
Views: 139
Reputation: 11
Maybe you can try something like :
1 - convert your index to datetime : data.index = pd.to_datetime(data.index)
2 - plot your dataframe year by year : ex data['1992'].plot()
I guess the first step is the most tricky
Upvotes: 1