How to plot Var(X|Y) against Y

I am working on the DQ guide project, I followed the instruction have the following scatter plot

combined.plot(kind = 'scatter',
             x = 'saf_s_11',
             y = 'sat_score')

image

I see a fanning-liked shape in the scatter plot and would like to dive deeper.

Question:
I want something like this:
y-axis: Var(X|Y)
x-axis: Y

X = combined['sat_score']
Y= combined['saf_s_11']

any other solution achieving the objective will be appricated, not limited to scatterplot.

Thanks.

You can refer to this stackoverflow guide https://stackoverflow.com/questions/43191783/create-a-conditional-plot-python.

1 Like
df = combined[['saf_s_11', 'sat_score']]
df['cat_saf'] = df['saf_s_11'].round()
df = df.groupby('cat_saf').var()

i do it this way, thank you. @alvinctk :slight_smile:

That’s good. I am rusty with pandas now. :sweat_smile:

1 Like

trials and errors :wink:

Yes, I went through that trials and errors phase too.

1 Like