Download (right-click, save target as ...) this page as a jupyterlab notebook from: Lab15-HW
LAST NAME, FIRST NAME
R00000000
ENGR 1330 ES-15 - Homework
# Preamble script block to identify host, user, and kernel
import sys
! hostname
! whoami
print(sys.executable)
print(sys.version)
print(sys.version_info)
! pwd
# Import dependencies!
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
Elapsed Time (s) | Speed (m/s) |
---|---|
0 | 0 |
1.01 | 3 |
2.07 | 7 |
3.3 | 12 |
4.2 | 20 |
5.3 | 30 |
6.1 | 45.6 |
Plot the speed vs time (speed on y-axis, time on x-axis) using a line plot. From examination of the plot, estimate the speed at time t = 5.0 (eyeball estimate)
# Create two lists; time and speed
# Create a line chart of speed on y axis and time on x axis
# Estimate:
Using the same series from Exercise 1, Plot the speed vs time (speed on y-axis, time on x-axis) using a scatter plot. From examination of the plot, estimate the speed at time t = 2.0 (eyeball estimate)
# Create a scatterplot chart
# Estimate:
Using the same series from Exercise 1, Plot the speed vs time (speed on y-axis, time on x-axis) using a line plot. Plot a second line based on the linear model
$$y = mx + b$$where
$$b=0~\text{and}~m=7.6$$# Code and run your solution here:
Using trial and error try to improve the 'fit' of the model, by adjusting values of $$m~\text{and}~b$$.
# Code and run your solution here:
Use pandas to read a dataframe from the file http://54.243.252.9/engr-1330-webroot/8-Labs/Lab15/census_18.csv
. Then produce a line plot of
the counts by age for the 2010 census, x-axis will be the series age
, y-axis will be the census values for 2010
.
######### CODE TO AUTOMATICALLY DOWNLOAD THE DATABASE ################
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/8-Labs/Lab15/census_18.csv' # a csv file
response = requests.get(remote_url) # Gets the file contents puts into an object
output = open('census_18.csv', 'wb') # Prepare a destination, local
output.write(response.content) # write contents of object to named local file
output.close() # close the connection
# Code and run your file read here
# Code and run your plot here
Using your dataframe from exercise 5, plot both the 2010 and 2014 census values by age. Plot the 2010 distribution in blue and the 2014 distribution in red.
# Code and run your plot here
Consider the data set "data" defined as
data = {'C':20, 'C++':15, 'Java':30, 'Python':35}
which lists student count by programming language in some school.
Produce a bar chart of number of students in each language, where language is the classification, and student count is the variable.
# Code and run your solution here
# Code and run your solution here