Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
A series of workshop materials and tutorials based on subjects surrounding 3D modeling, AR, and VR
David Rumsey Historical Map Collection has a wide variety of historical maps
import pandas as pd
#Simple Calculation
#Count
count_1 = df['var1'].count() #Count of one column (example: cases)
count_2 = df[['var1','var2']].count() #Count of more than one columns (example: cases, deaths)
count_all = df.count() #Count all varialbes in the table
#mean
mean_value = df['var1'].mean()
# mean = round(df['var1'].mean(),2) #If decimal places are needed
#standand deviation
std_value = df['var1'].std()
print('Descriptive statistics of cases')
print('Count:',count_1)
print('Mean',mean_value )
print('Stand Deviation',std_value)import pandas as pd
#Descriptive Statistics of one varialbe
descriptive_stats_1 = df['var1'].describe()
#Descriptive Statistics of more than one varialbes
descriptive_stats_2 = df[['var1','deaths']].describe()
#Descriptive Statistics of all numbercal varialbes in a dataframe
descriptive_stats_all = df.describe()subset_1 = df[['var1','var2','var3']] #Subset by column name(s)
subset_2 = df[df["var1"] > 100] #Select rows by value (example: value =100)#Collapse
#Collapse data by one varialbe, one aggregation method
df_1 = df.groupby(['var1'], dropna=True).sum().reset_index()
#Collapse data by one varialbe, by more than one aggregation methods
df_2 = df.groupby(['var1']).agg({'var2':['sum'], 'var3':['mean']}).reset_index() #var2, var3 need to be numeric data#Syntax: DataFrame.plot.line(x=None, y=None, **kwds)
line_1 = df_state_1.plot.line(y='deaths',x='state', rot=90, figsize=(10,3))
line_2 = df_state_1.plot.line(subplots=True,x='state', rot=90,figsize=(10,5))#Syntax: DataFrame.plot.scatter(x, y, s=None, c=None, **kwargs)
scatter = df_state_1.plot.scatter(x='cases', y='deaths')#Uplocad csv file from your local directory
from google.colab import files
uploaded = files.upload()
import pandas as pd
df = pd.read_csv('FILENAME.csv') #The filename of the uplpaded csv file
#df.shape
df.head()#Uplocad Excel file from your local directory
from google.colab import files
uploaded = files.upload()
import pandas as pd
df = pd.read_excel('FILENAME.xlsx') #The filename of the uplpaded csv file
#df.shape
df.head()#Example: NYT Github COVID-19 data
#https://raw.githubusercontent.com/nytimes/covid-19-data/master/live/us-counties.csv
url = 'The URL of data'
df = pd.read_csv(url)
#df.shape
df.head()#gspread setup
!pip install --upgrade gspread
#Authenticate access to your Google Drive
from google.colab import auth
auth.authenticate_user()
import gspread
from oauth2client.client import GoogleCredentials
gc = gspread.authorize(GoogleCredentials.get_application_default())
import pandas as pd
worksheet = gc.open('Google Sheets NAME').sheet1
rows = worksheet.get_all_values() # get_all_values gives a list of rows.
df = pd.DataFrame.from_records(rows) # Convert to a DataFrame and render.
df.head()#gspread setup
!pip install --upgrade gspread
#Authenticate access to your Google Drive
from google.colab import auth
auth.authenticate_user()
import gspread
from oauth2client.client import GoogleCredentials
gc = gspread.authorize(GoogleCredentials.get_application_default())
worksheet = gc.open_by_key('Google Sheets ID').worksheet('NAME OF A SHEET TAB') #Call by Sheet ID & Name
rows = worksheet.get_all_values() # get_all_values gives a list of rows.
df = pd.DataFrame.from_records(rows[1:], columns=rows[0]) # Convert to a DataFrame and render. 1st Row as Headers
df.head()!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth) #Copy and paste Google Authentication code
link = 'SHARING LINK' #The sharing link of the data file stored on your Google Drive
id = link.split("/")[-2]
#print(id)
downloaded = drive.CreateFile({'id':id})
downloaded.GetContentFile('covid_county.csv')
df = pd.read_csv('covid_county.csv')
df.head()#Mount Google Drive
from google.colab import drive
drive.mount('/content/drive')
path = '/content/drive/PATH TO THE FILE'
df = pd.read_csv(path)
df.head()from google.colab import files
df.to_csv('FILENAME.csv')
files.download('FILENAME.csv') #Download winder pops outfrom google.colab import drive
drive.mount('/content/drive') #Copy and paste Google Authentication code
df.to_csv('/content/drive/PATH TO Google Drive FOLDER')#Export bar chart
bar_image = bar_2.get_figure().savefig('bar_image.png')
from google.colab import files
files.download('bar_image.png') #Download window pops out
#Export line chart
line_image = line_1.get_figure().savefig('line_image.png')
from google.colab import files
files.download('line_image.png') #Download window pops out
#Export scatter plot chart
scat_image = scatter.get_figure().savefig('scatter_image.png')
from google.colab import files
files.download('scatter_image.png') #Download window pops out<!doctype html> <!-- This says your file is in .html -->
<html lang="en"> <!-- This says your file is in English -->
<head> <!-- This opens your header. Your header is where different libraries and plugins are loaded -->
<meta charset="utf-8">
<title>Put the Title of Your Map Here</title> <!-- Put the title of your map here -->
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
</head> <!-- Load Leaflet files locally -->
<link rel="stylesheet" href="./leaflet/leaflet.css"/> <!--Put the path to the leaflet.css you downloaded here -->
<script src="./leaflet/leaflet.js"></script> <!-- Put the path to the leaflet.js you downloaded here -->
</head><!-- In the body of the code, you need to create the division on the page for your map and call the map.js file you will make next -->
<body>
<div id = "map" style = "width:900px; height:580px;"></div> <!--set the size of your map -->
<script type="text/javascript" src="nameOfYourMap.js"></script> <!--call the javascript file for your map -->
</body>
</html>
var mapOptions = {
center: [42.336004, -71.169212], //set center Lat/Long of your area of interest
zoom: 16, //set initial zoom level
maxZoom : 24, //set max zoom level
tap : false //fix popup bug on Safari
}
//Creates map object according to map options
var map = new L.map('map', mapOptions);//Example of an externally called basemap
var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'});
Esri_WorldImagery.addTo(map);var bcLibrary= L.marker( [42.336004, -71.169212] ).addTo(map);
//adds marker at designated lat/long
var libraryPolygon = L.polygon([
[42.336477, -71.169550],
[42.336569, -71.169126],
[42.335788, -71.168826],
[42.335728, -71.169314]
]).addTo(map);//example code from leafletjs.com, in this case inserted directly into your map code
var states = [{
"type": "Feature",
"properties": {"party": "Republican"},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-104.05, 48.99],
[-97.22, 48.98],
[-96.58, 45.94],
[-104.03, 45.94],
[-104.05, 48.99]
]]
}
}, {
"type": "Feature",
"properties": {"party": "Democrat"},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-109.05, 41.00],
[-102.06, 40.99],
[-102.03, 36.99],
[-109.04, 36.99],
[-109.05, 41.00]
]]
}
}];//this looks the same as above, but now is done directly in the
//geojson file, which should be resaved as a .js file
var bcKMLTest = {
"type": "FeatureCollection",
"name": "Temporary Places",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature",
"properties": {
"Name": "Chestnut Hill Reservoir",
"description": "Water! " },
"geometry": { "type": "Point", "coordinates": [ -71.160451098751224, 42.335235738372397 ] } },
{ "type": "Feature",
"properties": {
"Name": "Football!",
"description": "Go Eagles!" },
"geometry": { "type": "Point", "coordinates": [ -71.166387763840049, 42.335024576048127 ] } },
{ "type": "Feature",
"properties": {
"Name": "Basketball and Hockey",
"description": "Go Sports!" },
"geometry": { "type": "Point", "coordinates": [ -71.16777265141657, 42.335122222222218 ] } }
]
}
//example of html header to call your spatial data
<script src="./bcKMLTest.js"></script>//with the external js holding your data, only this line of code needs to be added to add your data to the map
L.geoJSON(bcKMLTest).addTo(map);bcLibrary.bindPopup("<b>I'm the Boston College Library</b>");var ourImportedData = L.geoJSON(bcKMLTest, {
onEachFeature: popUp
}).addTo(map);//if your features come with various attributes already attached to them,
//this function will create your popup box based on those features!
function popUp(feature, layer) {
var out = [];
if (f.properties){
out.push("The name of location is is: " + feature.properties.Name);
out.push("The description of the location is:" + feature.properties.description);
out.push("Have a nice day!");
}
layer.bindPopup(out.join("<br />"));
}Use one candidate ID from a sheet tab to retrieve name and party, and office information through an API call, and output results to another sheet tab.
function CandidateData() {
var key = "YOUR API KEY" //API Key
var ss = SpreadsheetApp.getActiveSpreadsheet() //Assign Google Sheets (including all tabs) to varialbe ss
var wsName = ss.getSheetByName("person") //Assign tab "person" to varialbe wsName
var name = wsName.getRange("A2").getValue() ////Extract candidate id from tab "person"
let apiURL = 'https://api-stage.open.fec.gov/v1/candidate/'+ name + '/?api_key=' + key
var resText = UrlFetchApp.fetch(apiURL).getContentText() //Make the API call to extract data in JSON file format
var resJSON = JSON.parse(resText) //Parse JSON data
var record = resJSON["results"][0]
var can_name = resJSON["results"][0]["name"]
var party = resJSON["results"][0]["party_full"]
var office_f = resJSON["results"][0]["office_full"]
//*****Output Results**********//
var wsLiveData = ss.getSheetByName("live") //**SETUP OUTPUT SHEET
var candidate_name = wsLiveData.getRange("A2") //SETUP A2 for Candidate Name
var party_full = wsLiveData.getRange("B2") //SETUP B2 for Party Name
var office_full = wsLiveData.getRange("C2") //SETUP C2 for Office
candidate_name.setValue(can_name) //SEND extracted value to var candidate_name
party_full.setValue(party) //SEND extracted value to var party_full
office_full.setValue(office_f) //SEND extracted value to var office_full
}Use a list of candidate IDs from a range to retrieve name and party, and office information through an API call, and output results to another sheet tab.
function CandidateData() {
//API Key
var key = "YOUR API KEY"
var ss = SpreadsheetApp.getActiveSpreadsheet()
var wsResult = ss.getSheetByName("result") //Setup Output Sheet
var sheet = ss.getSheetByName('id_list').getRange("A1:A20").getValues() //Setup Input Sheet & Data range
var toAddTable =[]
for (i = 0; i < sheet.length; i++) {
//console.log(sheet[i][0])
var toAddArray = []
var name = sheet[i][0]
let apiURL = 'https://api-stage.open.fec.gov/v1/candidate/'+ name + '/?api_key=' + key
var resText = UrlFetchApp.fetch(apiURL).getContentText()
var resJSON = JSON.parse(resText)
var record = resJSON["results"][0]
var can_name = resJSON["results"][0]["name"]
var party = resJSON["results"][0]["party_full"]
var office_f = resJSON["results"][0]["office_full"]
//**********Add Values to the Created Table Array ********//
toAddArray.push(can_name)
toAddArray.push(party)
toAddArray.push(office_f)
toAddTable.push(toAddArray)
}
//console.log(toAddTable)
wsResult.getRange("A2:C21").setValues(toAddTable)
}
<!DOCTYPE html>
<html xml:lang="EN" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--COPY ME INTO HEAD--><script type="text/javascript" src="ZoomifyImageViewerFree-min.js"></script>
<!--COPY ME INTO HEAD--><script type="text/javascript"> Z.showImage("myContainer", "ZoomifyImageExample"); </script>
</head>
<body>
<!--COPY ME INTO BODY--><div id="myContainer" style="width:900px; height:500px; margin:auto; border:1px; border-style:solid; border-color:#696969; background-color:#000000;" ></div>
</body>
</html> <!--COPY ME INTO HEAD--><script type="text/javascript"> Z.showImage("myContainer", "sanFran"); </script>
<iframe src="https://bcdigschol.github.io/tilingMappingWorkshop/zoomifySanFran" title="Self-tiled San Francisco Chinatown Image" width="900px" height="500px"></iframe><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet 1.0.0-b1 Zoomify Demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.css" />
<style type="text/css">
html, body, #photo {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<div id="photo"></div>
<script src="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet-src.js"></script>
<script type="text/javascript" src="L.TileLayer.Zoomify.js"></script>
<script type="application/javascript">
var map = L.map('photo', {
maxZoom: 15, //Does not matter anymore, maxNativeZoom prevents loading of missing zoom levels
minZoom: 0,
crs: L.CRS.Simple //Set a flat projection, as we are projecting an image
});
//Loading the Zoomify tile layer, notice the URL
var layer = L.tileLayer.zoomify('http://thematicmapping.org/playground/zoomify/books/{g}/{z}-{x}-{y}.jpg', {
width: 5472,
height: 3648,
attribution: '© Photo: Bjørn Sandvik'
}).addTo(map);
//Setting the view to our layer bounds, set by our Zoomify plugin
map.fitBounds(layer.options.bounds);
</script>
</body>
</html><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet Zoomify San Fran Demo</title>
<link rel="stylesheet" href="./leaflet/leaflet.css" />
<style type="text/css">
html, body, #photo {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<div id="photo"></div>
<script src="./leaflet/leaflet-src.js"></script>
<script type="text/javascript" src="./Leaflet.Zoomify-master/L.TileLayer.Zoomify.js"></script>
<script type="application/javascript">
var map = L.map('photo', {
maxZoom: 15, //Does not matter anymore, maxNativeZoom prevents loading of missing zoom levels
minZoom: 0,
crs: L.CRS.Simple //Set a flat projection, as we are projecting an image
});
//Loading the Zoomify tile layer, notice the URL
var layer = L.tileLayer.zoomify('https://bcdigschol.github.io/tilingMappingWorkshop/sanFran/{g}/{z}-{x}-{y}.jpg', {
width: 13463,
height: 5952,
attribution: 'David Rumsey'
}).addTo(map);
//Setting the view to our layer bounds, set by our Zoomify plugin
map.fitBounds(layer.options.bounds);
</script>
</body>
</html>
<iframe src="https://bcdigschol.github.io/tilingMappingWorkshop/leafletZoomifySanFran" title="Self-tiled San Francisco Chinatown Image" width="900px" height="500px"></iframe>
https://www.gutenberg.org/cache/epub/23/pg23.txt
https://www.gutenberg.org/files/202/202.txt
https://www.gutenberg.org/cache/epub/34915/pg34915.txt
https://www.gutenberg.org/cache/epub/99/pg99.txtslave-child:children
slave-mother:mother
slave:slaves
master:masters
wife, wifes:wives
husband's:husband
husband:husbands
child, childs:children
baby, babys:babies
infant:infants
mother:mothers
father's:father
father:fathers
parent:parents
family, familys:famlies
















































































































my_stopwords= ['my_word1', 'my_word2'] #Add two custom stopwords
stop_words = stop_words + my_stopwords
#print(len(stop_words))
with open('data/stop_words.csv', 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(stop_words)This notebook finds the word frequencies for a dataset.
import matplotlib.pyplot as plt
a = transformed_word_frequency.most_common(20)
bar_values = list(list(zip(*a)))
x_val = list(bar_values[0])
y_val = list(bar_values[1])
plt.figure(figsize=(12,8)) #Customize plot size
plt.barh(x_val, y_val, color='blue',height=0.3)
plt.xlabel("Word Counts")
plt.gca().invert_yaxis()
#4 Find Word Frequencies
word_str = " "
# from collections import Counter
# # Hold our word counts in a Counter Object
# transformed_word_frequency = Counter()
# # Apply filter list
# for document in tdm_client.dataset_reader(dataset_file):
# if use_filtered_list is True:
# document_id = document['id']
# # Skip documents not in our filtered_id_list
# if document_id not in filtered_id_list:
# continue
# unigrams = document.get("unigramCount", [])
# for gram, count in unigrams.items():
# clean_gram = gram.lower() # Lowercase the unigram
word_str += " " + clean_gram #Added: string of all words
# if clean_gram in stop_words: # Remove unigrams from stop words
# continue
# if not clean_gram.isalpha(): # Remove unigrams that are not alphanumeric
# continue
# transformed_word_frequency[clean_gram] += count#Install wordcloud
pip install wordcloud#Install matplotlib for word plot cloud
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt #Added: plot word cloud
wordcloud = WordCloud(width = 800, height = 800,
background_color ='white',
stopwords = stop_words,
min_font_size = 10).generate(word_str)
# plot the WordCloud image
plt.figure(figsize = (8, 8), facecolor = None)
plt.imshow(wordcloud)
plt.axis("off")
plt.tight_layout(pad = 0)
plt.show() 















































































A DS Project can roughly be divided into three sections focusing on the project's data, the presentation of that data, and the contextualization of that data

















The effectiveness of a DS project can be evaluated in a number of ways, including clarity, ease of use, and effectiveness in accomplishing its goals.
https://arc.bc.edu/omeka-s-demo/iiif/3/1164https://iiif.archivelab.org/iiif/americanantislav1839chil/manifest.jsonhttps://iiif.archivelab.org/iiif/americanantislav1839chil/manifest.json






























































https://mapwarper.net/maps/tile/65580/{z}/{x}/{y}.png




