Login
📚 Python for Introductory Statistics: Lab Workbook
Chapters ▾

14.1 Descriptive Statistics with Pandas

Watch demo video

Pandas Library

Lab 14.1.1

Write a Python code to convert the dataset below to pandas data frame with variable name gender.

x = ['male','female','female','male','male']

view answer

Frequency and Relative Frequency with Pandas

Lab 14.1.2

Write a Python code using pandas to find the frequency counts of the following data: 20, 21, 25, 20, 29, 25, 22, 25, 21, 25

view answer

Lab 14.1.3

Write a Python code using pandas to find the relative frequency counts of the following data: 20, 21, 25, 20, 29, 25, 22, 25, 21, 25

view answer

Lab 14.1.4

20 students were asked if they were registered to vote. Their responses are listed below. Construct a frequency distribution using pandas.

NO, NO, YES, YES, NO, YES, NO, NO, YES, NO, YES, NO, NO, YES, YES, YES, YES, NO, YES, YES

view answer

Summary Statistics

Lab 14.1.5

A random sample of 54 annual salaries of Aviation employees of the City of Chicago is listed below. Write a Python code using pandas to compute summary statistics: mean, standard deviation, minimum, 1st quartile, 2nd quartile, 3rd quartile and maximum salary.

46776, 53736, 53736, 54840, 57408, 57408, 57408, 57408, 57408, 57408, 60108, 60108, 62712, 63552, 66852, 66852, 69732, 70032, 70044, 70272, 72024, 73380, 73380, 73380, 75408, 75468, 76248, 80484, 80484, 80484, 82476, 82788, 82836, 83676, 84324, 84324, 84324, 85848, 87564, 88272, 88272, 90828, 92004, 92304, 92520, 96060, 96096, 100680, 100716, 100716, 103764, 105420, 109620, 146868

view answer

Skewness and Kurtosis

Lab 14.1.6

A random sample of 54 annual salaries of Aviation employees of the City of Chicago is listed below. Write a Python code with pandas to compute the skewness and kurtosis values.

46776, 53736, 53736, 54840, 57408, 57408, 57408, 57408, 57408, 57408, 60108, 60108, 62712, 63552, 66852, 66852, 69732, 70032, 70044, 70272, 72024, 73380, 73380, 73380, 75408, 75468, 76248, 80484, 80484, 80484, 82476, 82788, 82836, 83676, 84324, 84324, 84324, 85848, 87564, 88272, 88272, 90828, 92004, 92304, 92520, 96060, 96096, 100680, 100716, 100716, 103764, 105420, 109620, 146868

view answer

Adapted from Python for Introductory Statistics: Student's Lab Workbook, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.