# Bar plot and proportion from data - 11:00 AM

(10 points)

Using your own random data from last week's forum question, let's use Colab to examine the `activity_level`

variable. Specifically:

- Generate a bar chart for
`activity_level`

and - Compute the proportion of folks whose activity level is
`high`

.

Note that creative burden is higher in this lab than in the last in that the Colab link above leads to a *blank* notebook. Nonetheless, you can find sample code that should help in our class presentation on Categorical Data.

## Comments

I got my data using this code:

I then generated a table for

`activity_level`

like so:high 39

moderate 33

none 28

I can now see the proportion is

$39/100 = 0.39$.

Finally, I generated my bar chart like so:

My data looked like this:

I isolated the activity level with this code:

So now I can see the proportion of high activity level to all participants is:

$30/100 = 0.3$

Here is my bar chart

I got my data using this code:

I then generated a table for 'activity level' like so:

high 37

moderate 27

none 36

I can now see that the proportion is

$37/100=0.37$

Finally, I generated my bar chart like so:

I got my data using this code:

I then generated a table for 'activity_level' like so:

high 40

moderate 33

none 27

I can now see the proportion is

$40/100 = 0.40$.

Finally, I generated my bar chart like so:

I got my data using this code

Then I generated a bar chart for 'activity_level' with this code

I can now see the proportion is

$27/100 = 0.27$

I got my data using this Code:

I then generated a table for activity_level like so:

Moderate 39

High 34

None 27

I can now see the proportion is:

$39/100$ = 0.39

finally I generated my bar chart like so:

I got my data using this code:

I then generated a table for 'activity_level' using the code:

moderate 44

high 32

none 24

I can now see the proportion is

$32/100 = 0.32$

Finally, I generated my bar chart using this code:

I got my data using this code

df.head()

Then I generated a table for " activity _level" like so

high 39

none 35

moderate 26

I can now see the proportion is

$39/100$ = 0.39

I got my data using:

Then I generated a table for 'activity_level' by doing this:

moderate 42

high 30

none 28

Now, we can see the proportion is

$42/100 = 0.42$

And this is the bar chart:

I got my data using this code:

I then generated a table for 'activity_level' like so:

high 40

moderate 30

none 30

I can now see the proportion is

$40/100 = 0.40$.

I generated my bar chart like so:

Here is my bar chart:

I got my data using code:I then generated a table for 'activity level' like so:none 37

high 32

moderate 31

I can now see the proportion is:$32/100 = 0.32$

Final, I generated my bar chart like so:I got my data using this code:

I then generated a table for"activity_level":

moderate 36

high 32

none 32

I can now see the proportion is

$32/100=0.32$.

finally, I generated my bar chart like so:

I got my data using this code:

Then I generated a table for 'activity_level' with this code:

None:36

High:35

Moderate:29

I can now see the proportion is

$35/100=0.35$

Finally I generated my bar chart like this:

I got my data using:

then I generated a table for 'activity_level' like so:

I can now see the proportion is

$37/100 =0.37$

finally, I generated my bar chart like so:

i got my data using this code:

i generated a table for my data with this:

high: 39

moderate: 33

none: 28

the proportion is clearly:

39/100 = .39

here is my bar chart:

I got my data using this code

I isolated the activity level with this code

none 40

moderate 32

high 28

Name: activity_level, dtype: int64

I can now see that my proportion is

28/100= 0.28

I generated my bar chart using the code

I got my data using this code:

I then generated a table for activity_level like so:

I can now see the proportion is

$34/100= 0.34$

Finally, I generated my bar chart using this code:

I got my data using code:

I then generated a table for 'activity level' like so:

none 43

moderate 29

High 28

I can Now see the proportion is

$43/100$

I then created a bar graph:

I found the values like this:

value_counts = df["activity_level"].value_counts()

value_counts

none-41

moderate-30

high-29

I now see the proportion is

29/100= 0.29

Finally I generated my bar chart like so:

value_counts.plot.bar(figsize=(12,7), rot = 0);

I got my data using this code:

Then I generated a table for " activity _level" using the code:

High 39

None 35

Moderate 26

I can now see the proportion

$39/100$ = .39

Finally I generated my bar graph by using the code: