Election Result Project

In the election result project under numpy module for Python course, there is a project where election results resulted in a different outcome from the survey result. Using binomial functions, new distributions were generated to determine the chance of failure. What is meant by scaling (dividing the generated distribution by the survey length?

2 Likes

why is the system showing me ‘typeerror’ when i use bins. there are no errors when i just use ‘bin’ but then there is no graph plotted and also the x-axis value are wrong. am i doing something wrong?

When you call functions you need to match up your arguments to the parameters of that function. Did you consider what the parameters of that function are when you wrote that code? If not, then you have no reason to expect that would do anything reasonable. Functions don’t read minds.

oh yeah, checked my code again. apparently i messed up my parameters earlier in the code which were causing the problem. thanks.

hey, i am a beginner and i am currently on this task, i had the same question as you, like what does it exactly mean when dividing the generated distribution by the survey length? to calculate what? did you figure it out in the end? thank you very much

1 Like

Bumping this up since I have the same question. Why did we need to divide the generated distribution by survey length?

The project walkthrough speaker, Matt, says that it’s to scale the results to the sample size but that still doesn’t make sense to me

One reason is that scaling allows you to compare the two distributions more easily. If you plot both distributions without scaling (and remove range=(0,1) from plt.hist arguments), you get this figure:

With scaling, you get this: