LDSSA / batch-admissions

0 stars 1 forks source link

SLU03 - Exercise 7 #6

Open ixjf opened 1 month ago

ixjf commented 1 month ago
  1. The exercise asks for title "Salary Distribution by Experience Level" but the code checks for "Salary Distribution in the US".
  2. The code checks for bins [41000, 43000, ...] with:

edge_pos = sorted([(i+n*10)*1000 for i in [41,43,45,47] for n in range(0,11)]) assert sum([int(x.get_x())==e for x,e in zip(_patches,edge_pos)]), 'The bin positions are not correct.'

but: a) this is not what is requested in the exercise (bins should go from 40000 to 160000 in steps of 10000), and b) if the initial and final bin edge positions are correct but the remaining ones are not, the assertion will still pass. Missing sum() == val?

Additionally, I'm not sure if

assert len(pc.axis.patches)==44, 'The plot does not have the correct number of bins.'

is correct.

edge_pos above seems to suggest the bin steps should be higher, in which case == 44 makes sense. In my case, I used df.pivot.plot.hist which gives me repeated bin edges [40000, 40000, 40000, 40000, 50000, 50000, 50000, 50000, ...] because of the different experience levels. I'm not sure if this could differ by making the histogram in a different way (i.e. the edges don't show up repeated)