Download (right-click, save target as ...) this page as a jupyterlab notebook from: Lab17-TH


Exercise Set 17: Descriptive Statistics

LAST NAME, FIRST NAME

R00000000

ENGR 1330 ES-17 - Homework


Exercise 0: Profile your computer

In [1]:
# Preamble script block to identify host, user, and kernel
import sys
! hostname
! whoami
print(sys.executable)
print(sys.version)
print(sys.version_info)
atomickitty
sensei
/opt/jupyterhub/bin/python3
3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]
sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)
In [5]:
# Let's import the necessary libraries:
import numpy as np
import pandas as pd
import statistics
import scipy.stats
import matplotlib.pyplot as plt 

Exercise1:

  1. Read the "Lubbock_Oct_T&P.csv" file as a dataframe and check its first few rows.
  2. Use descriptive functions of the Pandas library and explain the format of the dataframe
  3. Compute the arithmetic, harmonic, and geometric mean of 'temperature'.
  4. Find the median of 'precipitation' and 'temperature'.
  5. Report whether set of 'temperature' has one mode, two modes, or multiple modes.
  6. Find the range and IQR of 'precipitation'.
  7. Find the 10th,40th, and 70th percentile of 'temperature'.
  8. Provide a 5-number summary of 'precipitation'. Plot a box plot without outliers. Interpret it in your own words
  9. Find the variance and standard deviation of 'precipitation'.
  10. Find the skewness and kurtosis 'precipitation'.
In [6]:
######### CODE TO AUTOMATICALLY DOWNLOAD THE DATABASE ################
#! pip install requests #install packages into local environment
import requests # import needed modules to interact with the internet
# make the connection to the remote file (actually its implementing "bash curl -O http://fqdn/path ...")
remote_url = 'http://54.243.252.9/engr-1330-webroot/4-Databases/Lubbock_Oct_T&P.csv' # a csv file
response = requests.get(remote_url) # Gets the file contents puts into an object
output = open('Lubbock_Oct_T&P.csv', 'wb') # Prepare a destination, local
output.write(response.content) # write contents of object to named local file
output.close() # close the connection

If you get an error, or an empty file, then download using your browser and mouse.

In [7]:
#code here
# read the data into a dataframe
# info about the dataframe
# descriptive statistics for temperature
# median of precipitation and temperature
# how many modes temperature
# IQR precipitation
# Selected quantiles for temperature
# 5-number summary precipitation
# Boxplot
# Variance and standard deviation of 'precipitation'
# Skewness and kurtosis 'precipitation'