From daf77eec4e7ecd90e7d5f5d8b5ced8d49e51a25a Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Fri, 19 May 2017 13:35:25 -0400 Subject: [PATCH] updates basic demo notebook --- examples/Basic Usage.ipynb | 710 +++++++++++++++++++++++++++++++ examples/cartoframes demos.ipynb | 270 ------------ 2 files changed, 710 insertions(+), 270 deletions(-) create mode 100644 examples/Basic Usage.ipynb delete mode 100644 examples/cartoframes demos.ipynb diff --git a/examples/Basic Usage.ipynb b/examples/Basic Usage.ipynb new file mode 100644 index 000000000..d12393c21 --- /dev/null +++ b/examples/Basic Usage.ipynb @@ -0,0 +1,710 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Basic cartoframes functionality" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import cartoframes\n", + "from cartoframes.credentials import set_credentials\n", + "import pandas as pd\n", + "\n", + "# BASEURL are in the format:\n", + "# https://USERNAME.carto.com -- for all cloud users, even if in a multiuser organization\n", + "# for on premise installs, contact your admin\n", + "BASEURL = 'https://eschbacher.carto.com' # <-- replace with your username \n", + "APIKEY = 'abcdefghijklmnopqrstuvwxyz' # <-- your CARTO API key\n", + "set_credentials(base_url=BASEURL, api_key=APIKEY, overwrite=True)\n", + "\n", + "cc = cartoframes.CartoContext()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
the_geomthe_geom_webmercatorgeoidpoverty_counttotal_populationpoverty_per_poptotal_pop_2011_2015pop_determined_poverty_status_2011_2015commuters_16_over_2011_2015walked_to_work_2011_2015
cartodb_id
20103000020E6100000010000000B0000006D3A02B85982...0103000020110F0000010000000B000000D240DAA89070...36047005000323.112583741.00.0311919624.3652423304.4397974074.1926370.005207
30103000020E610000001000000090000006AA164726A80...0103000020110F000001000000090000009188EE63476D...360470108003818.8041242067.00.39613235743.80214328261.97996816316.2855480.016649
40103000020E6100000010000000E000000591822A7AF7F...0103000020110F0000010000000E000000F2591B1A0A6C...360470110001237.9857141306.00.18222512959.09005917101.3676904429.4349390.021986
60103000020E61000000100000008000000F5BD86E0B87E...0103000020110F000001000000080000009110AEED666A...36047012901257.2173911143.00.05005926191.50592818825.26500716044.5508290.009637
70103000020E6100000010000000C000000E6CDE15AED7E...0103000020110F0000010000000C0000008FF54811C06A...3604701690030.000000572.00.00000011023.18404822815.2451107607.7775370.010880
\n", + "
" + ], + "text/plain": [ + " the_geom \\\n", + "cartodb_id \n", + "2 0103000020E6100000010000000B0000006D3A02B85982... \n", + "3 0103000020E610000001000000090000006AA164726A80... \n", + "4 0103000020E6100000010000000E000000591822A7AF7F... \n", + "6 0103000020E61000000100000008000000F5BD86E0B87E... \n", + "7 0103000020E6100000010000000C000000E6CDE15AED7E... \n", + "\n", + " the_geom_webmercator geoid \\\n", + "cartodb_id \n", + "2 0103000020110F0000010000000B000000D240DAA89070... 360470050003 \n", + "3 0103000020110F000001000000090000009188EE63476D... 360470108003 \n", + "4 0103000020110F0000010000000E000000F2591B1A0A6C... 360470110001 \n", + "6 0103000020110F000001000000080000009110AEED666A... 360470129012 \n", + "7 0103000020110F0000010000000C0000008FF54811C06A... 360470169003 \n", + "\n", + " poverty_count total_population poverty_per_pop \\\n", + "cartodb_id \n", + "2 23.112583 741.0 0.031191 \n", + "3 818.804124 2067.0 0.396132 \n", + "4 237.985714 1306.0 0.182225 \n", + "6 57.217391 1143.0 0.050059 \n", + "7 0.000000 572.0 0.000000 \n", + "\n", + " total_pop_2011_2015 pop_determined_poverty_status_2011_2015 \\\n", + "cartodb_id \n", + "2 9624.365242 3304.439797 \n", + "3 35743.802143 28261.979968 \n", + "4 12959.090059 17101.367690 \n", + "6 26191.505928 18825.265007 \n", + "7 11023.184048 22815.245110 \n", + "\n", + " commuters_16_over_2011_2015 walked_to_work_2011_2015 \n", + "cartodb_id \n", + "2 4074.192637 0.005207 \n", + "3 16316.285548 0.016649 \n", + "4 4429.434939 0.021986 \n", + "6 16044.550829 0.009637 \n", + "7 7607.777537 0.010880 " + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Get a CARTO table as a pandas DataFrame\n", + "df = cc.read('brooklyn_poverty')\n", + "df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cartoframes import Layer, styling\n", + "l = Layer('brooklyn_poverty', color={'column': 'poverty_per_pop', 'scheme': styling.sunset(7)})\n", + "cc.map(layers=l, interactive=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
VendorIDtpep_pickup_datetimetpep_dropoff_datetimepassenger_counttrip_distancepickup_longitudepickup_latitudeRatecodeIDstore_and_fwd_flagdropoff_longitudedropoff_latitudepayment_typefare_amountextramta_taxtip_amounttolls_amountimprovement_surchargetotal_amount
022016-05-01 14:52:112016-05-01 15:00:3622.08-74.00670640.7304611.0N-74.01238340.7067791.08.50.00.51.000.00.310.30
112016-05-01 08:34:082016-05-01 08:49:0213.00-73.92495740.7441251.0N-73.97382440.7627791.013.50.00.52.000.00.316.30
212016-05-04 09:44:402016-05-04 10:07:0912.10-73.97348840.7485011.0N-73.99895540.7408332.014.50.00.50.000.00.315.30
322016-05-01 20:50:112016-05-01 21:05:2414.41-73.99978640.7432671.0N-73.96636240.7923702.015.00.50.50.000.00.316.30
422016-05-02 07:26:562016-05-02 07:53:5324.01-73.96363140.8033601.0N-73.95696340.7849391.019.50.00.54.060.00.324.36
\n", + "
" + ], + "text/plain": [ + " VendorID tpep_pickup_datetime tpep_dropoff_datetime passenger_count \\\n", + "0 2 2016-05-01 14:52:11 2016-05-01 15:00:36 2 \n", + "1 1 2016-05-01 08:34:08 2016-05-01 08:49:02 1 \n", + "2 1 2016-05-04 09:44:40 2016-05-04 10:07:09 1 \n", + "3 2 2016-05-01 20:50:11 2016-05-01 21:05:24 1 \n", + "4 2 2016-05-02 07:26:56 2016-05-02 07:53:53 2 \n", + "\n", + " trip_distance pickup_longitude pickup_latitude RatecodeID \\\n", + "0 2.08 -74.006706 40.730461 1.0 \n", + "1 3.00 -73.924957 40.744125 1.0 \n", + "2 2.10 -73.973488 40.748501 1.0 \n", + "3 4.41 -73.999786 40.743267 1.0 \n", + "4 4.01 -73.963631 40.803360 1.0 \n", + "\n", + " store_and_fwd_flag dropoff_longitude dropoff_latitude payment_type \\\n", + "0 N -74.012383 40.706779 1.0 \n", + "1 N -73.973824 40.762779 1.0 \n", + "2 N -73.998955 40.740833 2.0 \n", + "3 N -73.966362 40.792370 2.0 \n", + "4 N -73.956963 40.784939 1.0 \n", + "\n", + " fare_amount extra mta_tax tip_amount tolls_amount \\\n", + "0 8.5 0.0 0.5 1.00 0.0 \n", + "1 13.5 0.0 0.5 2.00 0.0 \n", + "2 14.5 0.0 0.5 0.00 0.0 \n", + "3 15.0 0.5 0.5 0.00 0.0 \n", + "4 19.5 0.0 0.5 4.06 0.0 \n", + "\n", + " improvement_surcharge total_amount \n", + "0 0.3 10.30 \n", + "1 0.3 16.30 \n", + "2 0.3 15.30 \n", + "3 0.3 16.30 \n", + "4 0.3 24.36 " + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# read in a CSV of NYC taxi data\n", + "df = pd.read_csv('taxi_sample.csv')\n", + "df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
VendorIDtpep_pickup_datetimetpep_dropoff_datetimepassenger_counttrip_distancepickup_longitudepickup_latitudeRatecodeIDstore_and_fwd_flagdropoff_longitudedropoff_latitudepayment_typefare_amountextramta_taxtip_amounttolls_amountimprovement_surchargetotal_amount
022016-05-01 14:52:112016-05-01 15:00:3622.08-74.00670640.7304611.0N-74.01238340.7067791.08.50.00.51.000.00.310.30
112016-05-01 08:34:082016-05-01 08:49:0213.00-73.92495740.7441251.0N-73.97382440.7627791.013.50.00.52.000.00.316.30
212016-05-04 09:44:402016-05-04 10:07:0912.10-73.97348840.7485011.0N-73.99895540.7408332.014.50.00.50.000.00.315.30
322016-05-01 20:50:112016-05-01 21:05:2414.41-73.99978640.7432671.0N-73.96636240.7923702.015.00.50.50.000.00.316.30
422016-05-02 07:26:562016-05-02 07:53:5324.01-73.96363140.8033601.0N-73.95696340.7849391.019.50.00.54.060.00.324.36
\n", + "
" + ], + "text/plain": [ + " VendorID tpep_pickup_datetime tpep_dropoff_datetime passenger_count \\\n", + "0 2 2016-05-01 14:52:11 2016-05-01 15:00:36 2 \n", + "1 1 2016-05-01 08:34:08 2016-05-01 08:49:02 1 \n", + "2 1 2016-05-04 09:44:40 2016-05-04 10:07:09 1 \n", + "3 2 2016-05-01 20:50:11 2016-05-01 21:05:24 1 \n", + "4 2 2016-05-02 07:26:56 2016-05-02 07:53:53 2 \n", + "\n", + " trip_distance pickup_longitude pickup_latitude RatecodeID \\\n", + "0 2.08 -74.006706 40.730461 1.0 \n", + "1 3.00 -73.924957 40.744125 1.0 \n", + "2 2.10 -73.973488 40.748501 1.0 \n", + "3 4.41 -73.999786 40.743267 1.0 \n", + "4 4.01 -73.963631 40.803360 1.0 \n", + "\n", + " store_and_fwd_flag dropoff_longitude dropoff_latitude payment_type \\\n", + "0 N -74.012383 40.706779 1.0 \n", + "1 N -73.973824 40.762779 1.0 \n", + "2 N -73.998955 40.740833 2.0 \n", + "3 N -73.966362 40.792370 2.0 \n", + "4 N -73.956963 40.784939 1.0 \n", + "\n", + " fare_amount extra mta_tax tip_amount tolls_amount \\\n", + "0 8.5 0.0 0.5 1.00 0.0 \n", + "1 13.5 0.0 0.5 2.00 0.0 \n", + "2 14.5 0.0 0.5 0.00 0.0 \n", + "3 15.0 0.5 0.5 0.00 0.0 \n", + "4 19.5 0.0 0.5 4.06 0.0 \n", + "\n", + " improvement_surcharge total_amount \n", + "0 0.3 10.30 \n", + "1 0.3 16.30 \n", + "2 0.3 15.30 \n", + "3 0.3 16.30 \n", + "4 0.3 24.36 " + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# send it to carto so we can map it\n", + "cc.write(df, 'taxi_sample',\n", + " lnglat=('pickup_longitude', 'pickup_latitude'),\n", + " overwrite=True)\n", + "df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cartoframes import Layer\n", + "cc.map(layers=Layer('taxi_sample'),\n", + " interactive=False)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Oops, there are some zero-valued long/lats in there, so the results are going to [null island](https://en.wikipedia.org/wiki/Null_Island). Let's remove them." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "df = df[(df['pickup_longitude'] != 0) | (df['pickup_latitude'] != 0)]\n", + "cc.write(df, 'taxi_sample', overwrite=True,\n", + " lnglat=('pickup_longitude', 'pickup_latitude'))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Let's take a look at what's going on at JFK airport, styled by the fare amount\n", + "cc.map(layers=Layer('taxi_sample',\n", + " size=4,\n", + " color={'column': 'fare_amount',\n", + " 'scheme': styling.sunset(7)}),\n", + " zoom=12, lng=-73.7880, lat=40.6629,\n", + " interactive=False)" + ] + } + ], + "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", + "version": "3.6.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/cartoframes demos.ipynb b/examples/cartoframes demos.ipynb deleted file mode 100644 index d73bc82de..000000000 --- a/examples/cartoframes demos.ipynb +++ /dev/null @@ -1,270 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# cartoframes demo" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false, - "scrolled": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "reload(cartoframes)" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "import pandas as pd\n", - "import carto\n", - "import cartoframes\n", - "\n", - "import json\n", - "from carto.auth import APIKeyAuthClient\n", - "\n", - "creds = json.loads(open('credentials.json').read())\n", - "API_KEY = creds['api_key']\n", - "USERNAME = creds['username']\n", - "BASEURL = 'https://{username}.carto.com/api/'.format(username=USERNAME)\n", - "\n", - "auth_client = APIKeyAuthClient(BASEURL, API_KEY)" - ] - }, - { - "cell_type": "raw", - "metadata": {}, - "source": [ - "# brooklyn_poverty poverty_per_pop\n", - "# dsny_monthly_tonnage_data\n", - "# us_counties pop_sqkm\n", - "# ny_boroughs boroname" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Grab dataset" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
geoidpoverty_countpoverty_per_popthe_geomthe_geom_webmercatortotal_population
cartodb_id
34360470341002100.6820650.1351440103000020E61000000100000005000000D784B4C6A07C...0103000020110F00000100000005000000D0DEA24ED866...745.0
13604700430010.000000NaN0103000020E6100000010000000700000037FC6EBA657F...0103000020110F00000100000007000000B7A199888C6B...140.0
102360470510023260.5000000.2165420103000020E610000001000000050000002D78D157907D...0103000020110F0000010000000500000093664E3C6F68...1203.0
49360470406002106.9078340.1675670103000020E6100000010000000700000021E9D32AFA7E...0103000020110F00000100000007000000D4559AD4D56A...638.0
69360470510011270.7287850.1307240103000020E61000000100000006000000A65EB7088C7D...0103000020110F00000100000006000000FC9A93EA6768...2071.0
\n", - "
" - ], - "text/plain": [ - " geoid poverty_count poverty_per_pop \\\n", - "cartodb_id \n", - "34 360470341002 100.682065 0.135144 \n", - "1 360470043001 0.000000 NaN \n", - "102 360470510023 260.500000 0.216542 \n", - "49 360470406002 106.907834 0.167567 \n", - "69 360470510011 270.728785 0.130724 \n", - "\n", - " the_geom \\\n", - "cartodb_id \n", - "34 0103000020E61000000100000005000000D784B4C6A07C... \n", - "1 0103000020E6100000010000000700000037FC6EBA657F... \n", - "102 0103000020E610000001000000050000002D78D157907D... \n", - "49 0103000020E6100000010000000700000021E9D32AFA7E... \n", - "69 0103000020E61000000100000006000000A65EB7088C7D... \n", - "\n", - " the_geom_webmercator \\\n", - "cartodb_id \n", - "34 0103000020110F00000100000005000000D0DEA24ED866... \n", - "1 0103000020110F00000100000007000000B7A199888C6B... \n", - "102 0103000020110F0000010000000500000093664E3C6F68... \n", - "49 0103000020110F00000100000007000000D4559AD4D56A... \n", - "69 0103000020110F00000100000006000000FC9A93EA6768... \n", - "\n", - " total_population \n", - "cartodb_id \n", - "34 745.0 \n", - "1 140.0 \n", - "102 1203.0 \n", - "49 638.0 \n", - "69 2071.0 " - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df = pd.read_carto(auth_client, tablename='brooklyn_poverty')\n", - "df.head()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Perform operations on dataset" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Map results" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false, - "scrolled": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.carto_map(interactive=True, stylecol='poverty_per_pop')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}