Skip to content

Instantly share code, notes, and snippets.

View arnicas's full-sized avatar

Lynn Cherny arnicas

  • Consultant / DS & NLP & Vis
  • France
View GitHub Profile
@arnicas
arnicas / umap_talk_example.py
Created December 16, 2022 16:33
UMAP bokeh code for Normconf talk
# pip install umap-learn!
from umap import UMAP
from sentence_transformers import SentenceTransformer
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, output_file, output_notebook, show
# get your text data into a list
bodyprompts = ["a list of text strings with body in them", "another string"]
@arnicas
arnicas / README.md
Last active February 13, 2024 06:21 — forked from aemkei/README.md
Google Maps URL Pano ID Extractor

StreetView URL Extractor

Paste a Google Maps URL and get back the parameters used to create a panorama.

@arnicas
arnicas / sample_geo_castle.tsv
Created September 23, 2020 12:47
Geolocated sample data for teaching pandas
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 17 columns, instead of 13. in line 2.
place image placeLabel location article linkname myLabels in_use latitude longitude displayName address place_id components region dept entity
http://www.wikidata.org/entity/Q1010703 http://commons.wikimedia.org/wiki/Special:FilePath/ChateaudAguilar.jpg Château d'Aguilar Point(2.746944444 42.890555555) https://en.wikipedia.org/wiki/Ch%C3%A2teau_d%27Aguilar Château d'Aguilar castle True 42.890555555 2.746944444 Château D'Aguilar Unnamed Road, 11350 Tuchan, France ChIJ7-WgxSI_sBIRbAkuRGas5P4 {'route': 'Unnamed Road', 'locality': 'Tuchan', 'administrative_area_level_2': 'Aude', 'administrative_area_level_1': 'Occitanie', 'country': 'France', 'postal_code': '11350'} Occitanie Aude Q1010703
http://www.wikidata.org/entity/Q1010879 http://commons.wikimedia.org/wiki/Special:FilePath/Ch%C3%A2teau%20d%27Arques.jpg Château d'Arques Point(2.36694444 42.95305556) https://en.wikipedia.org/wiki/Ch%C3%A2teau_d%27Arques Château d'Arques castle True 42.95305556 2.36694444 Château D'Arques D613, 11190 Arques, France ChIJWQCFuc3
@arnicas
arnicas / short_castles.tsv
Created September 23, 2020 12:08
Short Castle list for data teaching (wikipedia data)
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 9 columns, instead of 3. in line 4.
place image placeLabel location article linkname myLabels entity
0 http://www.wikidata.org/entity/Q835740 http://commons.wikimedia.org/wiki/Special:FilePath/Ch%C3%A2teau%20%28Pierre-Perc%C3%A9e%29.jpg Château de Pierre-Percée Point(6.930277777 48.470277777) https://en.wikipedia.org/wiki/Ch%C3%A2teau_de_Pierre-Perc%C3%A9e Château de Pierre-Percée castle Q835740
1 http://www.wikidata.org/entity/Q839242 http://commons.wikimedia.org/wiki/Special:FilePath/Haut-Landsbourg%20Cour.jpg Château du Hohlandsbourg Point(7.26916667 48.06) https://en.wikipedia.org/wiki/Ch%C3%A2teau_du_Hohlandsbourg Château du Hohlandsbourg castle Q839242
2 http://www.wikidata.org/entity/Q841527 http://commons.wikimedia.org/wiki/Special:FilePath/Ch%C3%A2teau%20Tiffauges%20entr%C3%A9e.JPG Château de Tiffauges Point(-1.114722222 47.016666666) https://en.wikipedia.org/wiki/Ch%C3%A2teau_de_Tiffauges Château de Tiffauges castle Q841527
3 http://www.wikidata.org/entity/Q842895 http://commons.wikimedia.org/wiki/Special:FilePath/Kintzheim%20B%20022
@arnicas
arnicas / 311_complaints_small.csv
Created September 23, 2020 10:21
extract of 311 complaints for teaching data analysis
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 52 columns, instead of 21. in line 1.
Unique Key,Created Date,Closed Date,Agency,Agency Name,Complaint Type,Descriptor,Location Type,Incident Zip,Incident Address,Street Name,Cross Street 1,Cross Street 2,Intersection Street 1,Intersection Street 2,Address Type,City,Landmark,Facility Type,Status,Due Date,Resolution Action Updated Date,Community Board,Borough,X Coordinate (State Plane),Y Coordinate (State Plane),Park Facility Name,Park Borough,School Name,School Number,School Region,School Code,School Phone Number,School Address,School City,School State,School Zip,School Not Found,School or Citywide Complaint,Vehicle Type,Taxi Company Borough,Taxi Pick Up Location,Bridge Highway Name,Bridge Highway Direction,Road Ramp,Bridge Highway Segment,Garage Lot Name,Ferry Direction,Ferry Terminal Name,Latitude,Longitude,Location
26589651,10/31/2013 02:08:41 AM,,NYPD,New York City Police Department,Noise - Street/Sidewalk,Loud Talking,Street/Sidewalk,11432,90-03 169 STREET,169 STREET,90 AVENUE,91 AVENUE,,,ADDRESS,JAMAICA,,Precinct,Assigned,10/31/2013 10:08:4
@arnicas
arnicas / bikes.tsv
Created September 23, 2020 09:50
Bike Data for Teaching Pandas
Date Berri 1 Brébeuf (données non disponibles) Côte-Sainte-Catherine Maisonneuve 1 Maisonneuve 2 du Parc Pierre-Dupuy Rachel1 St-Urbain (données non disponibles)
01/01/2012 35 0 38 51 26 10 16
02/01/2012 83 1 68 153 53 6 43
03/01/2012 135 2 104 248 89 3 58
04/01/2012 144 1 116 318 111 8 61
05/01/2012 197 2 124 330 97 13 95
06/01/2012 146 0 98 244 86 4 75
07/01/2012 98 2 80 108 53 6 54
08/01/2012 95 1 62 98 64 11 63
09/01/2012 244 2 165 432 198 12 173
@arnicas
arnicas / plotly_w2v_embedding.py
Created July 13, 2019 13:13
create interactive umap embedding display for a word2vec model by simple script
"""
Script originally sourced from Peter Baumgartner
here: https://gist.github.com/pmbaumgartner/adb33aa486b77ab58eb3df265393195d
and then modified by Lynn Cherny to allow a corpus file,
any gensim w2v model file, and make or read a counts file before the
UMAP display.
The counts are used to focus on the most common words, and more
frequent words show as lighter colors in the UMAP display Peter made.
NOTE: Pip install umap-learn not umap; the import method below fixes a bad install/umap issue.
"""
@arnicas
arnicas / Screenshot.png
Last active July 23, 2017 13:43
Bot Links and How-To's
Screenshot.png
We couldn’t find that file to show.
@arnicas
arnicas / index.html
Last active April 8, 2016 18:30
Animate a dot with a few transitions
<!DOCTYPE html>
<html>
<style>
circle {
fill: blue;
}
svg {