python - Plotting GroupBy Object in Pandas -
i have dataframe various parameters (continuous time-series data) , other columns filter out various conditions; these made of 1
when condition true , nan
when condition false.
if plot parameter , plot again in gate, can do:
df.parameter.plot() df.groupby('filter_column').parameter.plot(style='bo')
this example works fine, if want plot using line (style='b-'
example) joins groups of filtered data line
a work-around create intermediate series, or multiply 2 columns within matplotlib call:
series = df.parameter * df.filter_column series.plot(style='b-') plt.plot(df.parameter * df.filter_column,'b-')
i'm not fan of type of plot statement or creating intermediate columns. useful have direct groupby
line plot deal nas in same way series.
does have more elegant workarounds this?
Comments
Post a Comment