$ git clone [email protected]:berkeley-food-recommendations/data-gathering.git
You're cloning the main repository - be careful! We're going to enforce a "no committing to master directly" rule, so no committing directly to master, please.
# pylint: disable=W0612 | |
import time | |
import pandas as pd | |
import numpy as np | |
import iopro | |
import gc |
#!/usr/bin/python | |
# | |
# (originally entered at https://gist.github.com/1035399) | |
# | |
# License: GPLv3 | |
# | |
# To download the AFINN word list do: | |
# wget http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6010/zip/imm6010.zip | |
# unzip imm6010.zip | |
# |
public class Maze { | |
public int counter = 0; | |
public char[][] maze = | |
{{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, | |
{'#', ' ', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'}, | |
{'#', ' ', ' ', ' ', '#', ' ', '#', ' ', '#', '#'}, | |
{'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'}, | |
{'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'}, |
public class Maze_Best { | |
public int counter = 0; | |
private final static int MAX_VALUE = 1000; | |
int best_solution = MAX_VALUE; | |
public char[][] maze = | |
{{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, | |
{'#', ' ', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'}, |
""" | |
Use a Counter to find the most common words in "The Wonderful Wizard of Oz" by | |
L. Frank Baum. | |
Available in (mostly) plain text at: | |
https://archive.org/stream/wonderfulwizardo00baumiala/wonderfulwizardo00baumiala_djvu.txt | |
Note: This code also counts the words in the header, so it's not a *realistic* | |
applicaton, but more of a demonstration of python's Counter. |
import numpy as np | |
import pandas as pd | |
import pylab as pl | |
baseball = pd.read_csv("http://bit.ly/144sh7t") | |
# group by year and get a summary of each numeric column | |
baseball.groupby(["year"]).describe() | |
# for each year, get the mean of each column | |
baseball.groupby(["year"]).aggregate(np.mean) |
from dateutil.parser import parse | |
import pandas as pd | |
# monthly slaughter records since 1921 | |
df = pd.read_csv("http://bit.ly/119792b") | |
# parse the data (we could also use pd.to_datetime) | |
df.date = df.date.apply(parse) | |
# sort the data frame by date | |
df = df.sort(['date']) | |
# create an index |
""" | |
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ] | |
Modified from remove_output by Minrk | |
""" | |
import sys | |
import io | |
import os | |
from IPython.nbformat.current import read, write |