Class 15 — Monday, September 28

String and CSV Chrestomathics

CVS Drugstore — Is not to be examined — CSV files yes


Look both ways


Agenda


Readability


Downloads


To do


Program weathering_heights.py — you don't need a weather person to know which way the wind blows

Insight by examples

<!DOCTYPE html> <html class="no-js"> ...

<div class="row row-odd row-forecast"><div class="col-sm-2 forecast-label"><b>Today</b></div> <div class="col-sm-10 forecast-text"> A slight chance of rain before 2pm, then a slight chance of showers after 2pm. Mostly sunny, with a high near 79. South wind around 9 mph. Chance of precipitation is 20%. </div> ...

</body> </html>

<!DOCTYPE html> <html class="no-js"> ...

<div class="row row-odd row-forecast"><div class="col-sm-2 forecast-label"><b>Today</b></div> <div class="col-sm-10 forecast-text"> A slight chance of showers. Mostly sunny, with a high near 81. Southwest wind around 18 mph. Chance of precipitation is 20%. </div> ...

</body> </html>

<!DOCTYPE html> <html class="no-js"> ...

<div class="row row-odd row-forecast"><div class="col-sm-2 forecast-label"><b>Today</b></div> <div class="col-sm-10 forecast-text"> Sunny, with a high near 69. Breezy, with a north northwest wind 20 to 25 mph, with gusts as high as 35 mph. </div> ...

</body> </html>

Some program runs

Enter zipcode: 22903

A slight chance of rain before 2pm, then a slight chance of showers after 2pm. Mostly sunny, with a high near 79. South wind around 9 mph. Chance of precipitation is 20%.

Enter zipcode: 14301

A slight chance of showers. Mostly sunny, with a high near 81. Southwest wind around 18 mph. Chance of precipitation is 20%.

Enter zipcode: 66952

Sunny, with a high near 69. Breezy, with a north northwest wind 20 to 25 mph, with gusts as high as 35 mph.

Algorithm


Some more datasets

Location, Author, Max Height, Min Height

Narnia, Lewis, 4810, -10

Neverland, Milne, 426, -2

Oz, Baum, 1231, 679

Sleepy Hollow, Irving, 1629, 304

Stars Hollow, Sherman-Palladino, 725, 152

Toyland, MacDonough, 6187, 0

Wonderland, Carroll, 5895, -5

Country, Females, Males

Australia, 11175724, 11092660

Fiji, 421365, 439258

French Polynesia, 132082, 138682

New Caledonia, 125322, 125548

New Zealand, 2223281, 2144855

Papua New Guinea, 3359979, 3498287

Solomon Islands, 259909, 278239

Vanuatu, 117573, 122078

Zipcode, Town, State, Latitude, Longitude

00210, Portsmouth, NH, 43.005895, -71.013202

00211, Portsmouth, NH, 43.005895, -71.013202

00212, Portsmouth, NH, 43.005895, -71.013202

00213, Portsmouth, NH, 43.005895, -71.013202

00214, Portsmouth, NH, 43.005895, -71.013202

00215, Portsmouth, NH, 43.005895, -71.013202

00501, Holtsville, NY, 40.922326, -72.637078

00544, Holtsville, NY, 40.922326, -72.637078

...

99403, Clarkston, WA, 46.400365, -117.08313

99536, Kennewick, WA, 46.216706, -119.160173



Program csv_is_not_a_pharmacy.py — streamlining getting a dataset

Some program runs

Enter name of dataset: oceania.csv

dataset:

Country, Females, Males

Australia, 11175724, 11092660

Fiji, 421365, 439258

French Polynesia, 132082, 138682

New Caledonia, 125322, 125548

New Zealand, 2223281, 2144855

Papua New Guinea, 3359979, 3498287

Solomon Islands, 259909, 278239

Vanuatu, 117573, 122078

header:

['Country', 'Females', 'Males']

data:

['Country', 'Females', 'Males']

['Australia', 11175724, 11092660]

['Fiji', 421365, 439258]

['French Polynesia', 132082, 138682]

['New Caledonia', 125322, 125548]

['New Zealand', 2223281, 2144855]

['Papua New Guinea', 3359979, 3498287]

['Solomon Islands', 259909, 278239]

['Vanuatu', 117573, 122078]

Enter name of dataset: elevations.csv

dataset:

Location, Author, Max Height, Min Height

Narnia, Lewis, 4810, -10

Neverland, Milne, 426, -2

Oz, Baum, 1231, 679

Sleepy Hollow, Irving, 1629, 304

Stars Hollow, Sherman-Palladino, 725, 152

Toyland, MacDonough, 6187, 0

Wonderland, Carroll, 5895, -5

header:

['Location', 'Author', 'Max Height', 'Min Height']

data:

['Narnia', 'Lewis', 4810, -10]

['Neverland', 'Milne', 426, -2]

['Oz', 'Baum', 1231, 679]

['Sleepy Hollow', 'Irving', 1629, 304]

['Stars Hollow', 'Sherman-Palladino', 725, 152]

['Toyland', 'MacDonough', 6187, 0]

['Wonderland', 'Carroll', 5895, -5]



Program where_is_it.py — where is it


Lebanon, KS, 66952, 39°48′38″N 98°33′22″W

geocenter plaque

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.