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
# -*- coding: utf-8 -*- | |
""" | |
common-crawl-cdx.py | |
A simple example program to analyze the Common Crawl index. | |
This is implemented as a single stream job which accesses S3 via HTTP, | |
so that it can be easily be run from any laptop, but it could easily be | |
converted to an EMR job which processed the 300 index files in parallel. |
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
# see also https://github.com/wrobstory/pgshift | |
import gzip | |
from io import StringIO, BytesIO | |
from functools import wraps | |
import boto | |
from sqlalchemy import MetaData | |
from pandas import DataFrame | |
from pandas.io.sql import SQLTable, pandasSQL_builder |
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
# Copyright Mathieu Blondel December 2011 | |
# License: BSD 3 clause | |
import numpy as np | |
import pylab as pl | |
from sklearn.base import BaseEstimator | |
from sklearn.utils import check_random_state | |
from sklearn.cluster import MiniBatchKMeans | |
from sklearn.cluster import KMeans as KMeansGood |