This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX dct: <http://purl.org/dc/terms/> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX gac: <http://data.kasabi.com/dataset/government-art-collection/schema/> | |
SELECT ?work ?name ?image ?page WHERE { | |
?subject skos:prefLabel "Flemish School". | |
?work dct:subject ?subject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csvFile = csv.reader(open('thing.csv', 'rU'), delimiter=',') | |
header = next(csvFile) | |
for row in csvFile: | |
devStatus = row[4] | |
address = row[14] | |
commercial = row[12] | |
comment = row[20] | |
industry = row[10] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csvFile = csv.reader(open('survey.csv', 'rb'), delimiter=',') | |
header = next(csvFile) | |
for row in csvFile: | |
devStatus = row[4] | |
address = row[14] | |
commercial = row[12] | |
# note = row[20] | |
industry = row[10] | |
if row[20]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assign variable to a csv file read by csv.reader | |
csvFile = csv.reader(open('/Users/Zach/Desktop/survey.csv', 'rb'), delimiter=',') | |
# identify header row | |
header = next(csvFile) | |
# loop rows in csv file, and identify variables for fields | |
for row in csvFile: | |
if row[20] < 0: | |
continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX def: <http://data.kasabi.com/dataset/european-election-results/def/> | |
PREFIX cube: <http://purl.org/linked-data/cube#dataset> | |
Select ?label | |
WHERE { | |
?subject rdfs:label ?label ; | |
?p <http://data.kasabi.com/dataset/european-election-results/2009/political_groups/seats_won> . | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix dcterm: <http://purl.org/dc/terms/> . | |
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | |
@prefix ns1: <http://linkedrecipes.org/schema/> . | |
<http://data.kasabi.com/dataset/foodista/recipe/3QWJPYHF> a <http://linkedrecipes.org/schema/Recipe>; | |
ns1:ingredient <http://data.kasabi.com/dataset/foodista/food/DSVFF8DN>, | |
<http://data.kasabi.com/dataset/foodista/food/FBPQ4456>, | |
<http://data.kasabi.com/dataset/foodista/food/HSBJL3L8>, | |
<http://data.kasabi.com/dataset/foodista/food/JGYY7HZX>, | |
<http://data.kasabi.com/dataset/foodista/food/N5VJMXRC>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sample SPARQL query to find Crab Recipes in Kasabi's [food](http://kasabi.com/dataset/food) dataset. | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX recipe: <http://linkedrecipes.org/schema/> | |
SELECT ?label ?recipe WHERE { | |
<http://data.kasabi.com/dataset/food/foods/crab> recipe:ingredient_of ?recipe . | |
?recipe a recipe:Recipe . | |
?recipe rdfs:label ?label . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import sys | |
import csv | |
import re | |
csv.writer(open('out.csv', 'wb'),).writerows(row for row in csv.reader(open('in.csv', 'rb')) if len(row) >= 6 and "gmail" in row[5]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16. header = next(csvFile) | |
line 16, in <module> | |
header = next(csvFile) | |
_csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dive Into Python (Mark Pilgrim) | |
- Highlight on Page 11 | Loc. 218-19 | Added on Monday, June 13, 2011, 09:54 PM | |
You KNOW HOW OTHER books go on and on about programming fundamentals, and finally work up to building a complete, working program? Let's skip all that. | |
========== | |
Dive Into Python (Mark Pilgrim) | |
- Note on Page 11 | Loc. 219 | Added on Monday, June 13, 2011, 09:54 PM | |
Often love this approach to learning, but appreciate context too. |
OlderNewer