Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
import pandas as pd | |
df = pd.DataFrame([[1, 2, 's'], [3, 4, 't'], [4, 5, 'u']], | |
index=[-1, 0, 1], columns=['a', 'b', 'c']) | |
>>> df.a # Correct type | |
-1 1 | |
0 3 | |
1 4 | |
Name: a, dtype: int64 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# http://docs.cherrypy.org/stable/concepts/basics.html | |
import cherrypy | |
class HelloWorld: | |
def index(self): | |
return "Hello world!" | |
index.exposed = True | |
cherrypy.quickstart(HelloWorld()) |
This file contains 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
""" | |
Usage: | |
Nielsen2017Linking_camera.py | |
Notes | |
----- | |
This script demonstrates the use of Wikidata together with | |
ImageNet-based deep learning classifiers. It relates to the manuscript | |
"Linking ImageNet WordNet Synsets with Wikidata" from 2018. |
This file contains 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
# Code inspired and developed from: | |
# http://streamhacker.com/2010/05/10/text-classification-sentiment-analysis-naive-bayes-classifier/ | |
from __future__ import division | |
import nltk.classify, nltk.corpus, nltk.classify.util | |
from pylab import * | |
filebase = '/home/fn' | |
This file contains 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
######### | |
# Tornado | |
wget https://raw.github.com/facebook/tornado/master/demos/helloworld/helloworld.py | |
python helloworld.py | |
# 100 concurrent | |
ab -c 100 -n 1000 -k localhost.localdomain:8888/ | grep "Time taken for tests:" | |
# Time taken for tests: 0.709 seconds | |
# 5 concurrent |
This file contains 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
import re | |
import requests | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
pd.Series({re.findall('^(.+)\n', section)[0]: len(re.findall('^\*', section, flags=re.MULTILINE)) for section in re.split('^##[^#]', requests.get('https://raw.githubusercontent.com/josephmisiti/awesome-machine-learning/master/README.md').text, flags=re.MULTILINE)[1:-1]}).plot(kind='barh', title="'Awesome' machine learning links") | |
plt.show() |
This file contains 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
import matplotlib.pyplot as plt | |
import networkx as nx | |
from pysqlite2 import dbapi2 | |
connection = dbapi2.Connection('bredewiki-templates.sqlite3') | |
sql = "SELECT DISTINCT pid FROM brede WHERE (template='paper' OR template='conference_paper');" | |
cursor = connection.cursor() | |
cursor.execute(sql) | |
pids = [ row[0] for row in cursor.fetchall() ] |
This file contains 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
# wget http://neuro.imm.dtu.dk/services/bredewiki/download/bredewiki-templates.sqlite3 | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
from pysqlite2 import dbapi2 | |
connection = dbapi2.Connection('bredewiki-templates.sqlite3') | |
sql = "SELECT DISTINCT tid FROM brede WHERE (template='paper' OR template='conference_paper');" | |
cursor = connection.cursor() | |
cursor.execute(sql) | |
tids = [ row[0] for row in cursor.fetchall() ] |