Suppose I have the following Pandas df:
import pandas as pd
df = pd.DataFrame( data = {'Day': ['2020-08-30', '2020-08-30','2020-08-30','2020-08-30',
'2020-08-29', '2020-08-29','2020-08-29','2020-08-29',
'2020-08-28', '2020-08-28','2020-08-28','2020-08-28'],
'Curve': ['Brazil', 'Japan','Brazil', 'Japan','Brazil', 'Japan','Brazil', 'Japan','Brazil', 'Japan','Brazil', 'Japan'],
'Value': [100, 950, 200, 1000, 50, 50, 250, 1200, 20, 30, 240, 1100],
'Expiry': ['1Y', '1Y', '2Y','2Y','1Y','1Y','2Y','2Y', '1Y','1Y','2Y','2Y']})
df['Difference'] = df.groupby(['Curve', 'Expiry']).Value.diff(-1)
I would like to plot it and have it result in the following graph, would anyone know how to do that? Basically, to plot the "difference" by "Curve", where the X axis is the "Expiry". I don't care about the legends, axis-name, etc. Just to understand how to plot the curves by expiry.
Desired Pyplot graph
Also interested if its possible to know how to plot the curves in two separate graphs (i.e, one graph for each separate curve). Thanks in advance and have a good day