I have a dataframe with various parameters (continuous time-series data) and other columns to filter out various conditions; these are made up of 1
when the condition is true and NaN
when the condition is false.
If I plot a parameter and then plot it again just in the gate, I can do:
df.parameter.plot()
df.groupby('filter_column').parameter.plot(style='bo')
This example works fine, but if I want to plot using a line (style='b-'
for example) it then joins the groups of filtered data with a line
A work-around is to create intermediate series, or multiply the two columns within a matplotlib call:
series = df.parameter * df.filter_column
series.plot(style='b-')
plt.plot(df.parameter * df.filter_column,'b-')
I'm not a fan of this type of plot statement or creating the intermediate columns. It would be really useful to have the direct groupby
line plot deal with the NAs in the same way as a series.
Does anyone have any more elegant workarounds for this?