Random heights

edited June 7 in Assignments

(5pts)

I've got a fun program on my webpage that generates random CSV data for people. You can access it via Python like so:

%matplotlib inline
import pandas as pd
df = pd.read_csv('https://www.marksmath.org/cgi-bin/random_data.csv?username=mark')
df.tail()
first_name last_name age sex height weight income activity_level
0 Donna Dinan 35 female 65.37 164.26 1947 high
1 Antonia Davis 39 female 64.95 140.40 2188 none
2 Stephanie Buss 30 female 60.75 181.83 18108 high
3 Wendell Elmore 26 male 64.68 157.90 1935 moderate
4 Nina Mcilhinney 21 female 59.94 163.38 5675 none

Here's the cool thing - the data is randomly generated but the random number generator is seeded using the username query parameter in the URL. Thus, if I execute that command several times, I get the same result every time. That result depends upon the username, however. Thus, if you do it with your forum username, you'll get a different result. Thus, we all have our own randomly generated data file!

The problem: Using the code above with your username, generate your data file and then

  1. Compute the average value of the heights in your data and
  2. create a histogram of the heights.

Be sure to include both the code that you typed, as well as the results in your post.

Comments

  • edited June 7

    Code:

    df.hist('height', edgecolor='black', grid=False,);
    

    Histogram:

    Mean: 66.207700
    Mean Code:

    df.height.describe()
    
    mark
  • edited June 7
    df.hist('height', grid=False, edgecolor='black')
    

    mark
  • benben
    edited June 7

    df.hist('height', edgecolor='black', grid=False,);
    
  • edited June 7

    Mean=67.024500
    Standard Deviation=3.809777

    Code for the histogram:

    df.hist('height', edgecolor='black', grid=False,);
    
    mark
  • edited June 7
    %matplotlib inline
    import pandas as pd
     df = pd.read_csv('https://www.marksmath.org/cgi-bin/random_data.csv?username=sarah')
    df.tail()
    

    df.hist('height', edgecolor='black', grid=False,
       );
    

    mean: 66.266400

    df.height.describe()
    
    mark
  • I generated my histogram like so:

    df.hist('height', grid=False, edgecolor='black')
    

  • edited July 8
    df.hist('height', edgecolor='black', grid=False,);
    

    df.height.mean()
    
    # Out:
    # 66.73939999999999
    
    audrey
  • edited July 8

    I generated my histogram like so:

    df.hist('height', grid='false', edgecolor='black',)
    
    mark
  • edited June 7

    Code for histogram:

    df.hist('height', edgecolor='black', grid=False,);
    

    mark
  • edited July 8

    I generated my mean like so:

    df.height.mean()
    

    66.30110000000003

    mark
  • edited June 7

    This is an example of my histogram:

     df.hist('height', edgecolor='black', grid=False);
    

    The mean was generated this way:

     df.height.mean()
    

    65.81690000000002

    The standard deviation is:

    df.height.std()
    

    3.854679615661196

    mark
This discussion has been closed.