test-conda/index.ipynb

154 lines
23 KiB
Plaintext
Raw Normal View History

2017-07-24 20:33:10 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Welcome to an example Binder"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2017-07-27 18:29:23 +00:00
"This notebook uses a Python environment with a few libraries, including `dask`, all of which were specificied using a `conda` [environment.yml](../edit/environment.yml) file. To demo the environment, we'll show a simplified example of using `dask` to analyze time series data, adapted from Matthew Rocklin's excellent repo of [dask examples](https://github.com/blaze/dask-examples) — check out that repo for the full version (and many other examples)."
2017-07-24 20:33:10 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup plotting"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Turn on a global progress bar"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from dask.diagnostics import ProgressBar"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"progress_bar = ProgressBar()\n",
"progress_bar.register()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate fake data"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import dask.dataframe as dd"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"df = dd.demo.make_timeseries(start='2000', end='2015', dtypes={'A': float, 'B': int},\n",
" freq='5s', partition_freq='3M', seed=1234)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Compute and plot a cumulative sum"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[########################################] | 100% Completed | 16.5s\n"
]
},
{
"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zWL2o87LuVipgSfCTiO48SwYQM8/zz8\n7GcW2dO2rZmHEkHVFEiXLvDww9lp/imLKwHHcZyAPXvgF7+A44+HY46xtnbtLO1zIhQXmzO4SRMY\nMSJyEGczbg5yHMcJmDkTpk2DTz+FesErcvPmsGlTYtd/9BEcdljtyVcb+EzAcRwnYNkyS/DWtGnU\nVh0lMH06fP/7tSNbbeFKwHEcJ2DZMujUqXRbixaVK4EwP9CePfDyy1Y5LJdwJeA4jgNs2QI33ADf\n+17p9spmAl99ZZFAmzfDY49B48ZR7YBcwZWA4zgOlvsf4OqrS7c3bw4bN8a/5tNPbbtiBfzpT3Dv\nvZEvIVfIMXEdx3Gqx9SpZqapipkz4ec/L5/q+bDDLFS0pKT8NTNm2HbUKFi9GgYOTFrctONKwHGc\nOs1vfgNnn115rL+qregNw0JjOfpoM/N89FH5c+PHQ5s28M9/wjXXgMQt4JjduBJwnAyycaNVnnJq\nj7lzbXvAAfHPb9liJpznn4dT4pbCghNPtCygsezebeGkYcH4X/4yNfKmG1cCjpNB+vdPflXpPffA\nmjWpkaeusXOnOW3DFM6xaZ5DZs60N/i7744SvpXl4IPh3XfhmWeitr32Msfw4MF23KZNamVPF64E\nHCdD7N4NK1eameG7StsJsH175MT85hu4/nr4299qR8ZcZ+1aG5xnz7ZUDsuXl++zeTOcdRZcd13F\n9+ndG8aNg4suKp1V9NJLYcAAm03kKq4EHCcFrF9v8eErVyZ+zdtvW9Hx9u1L16Ktiv/6L5tBrF0L\n++5rbSNHVk+RpIPt22H
"text/plain": [
"<matplotlib.figure.Figure at 0x7f3e3831f390>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2017-07-27 18:29:23 +00:00
"df.A.cumsum().resample('1w').mean().compute().plot();"
2017-07-24 20:33:10 +00:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2017-07-27 18:29:23 +00:00
"version": "3.6.1"
2017-07-24 20:33:10 +00:00
}
},
"nbformat": 4,
2017-07-27 18:29:23 +00:00
"nbformat_minor": 2
2017-07-24 20:33:10 +00:00
}