Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Guides] - Final Review #1266

Merged
merged 49 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
426adca
Add vertical scroll in long code responses
elenatorro Nov 28, 2019
1804102
Fix typo and use GeoPandas
elenatorro Nov 28, 2019
8736da0
Fix links
elenatorro Nov 28, 2019
795d4db
Simplify polygon
elenatorro Nov 28, 2019
ec94b8c
Use tags instead
elenatorro Nov 28, 2019
ddc177e
Fix code spaces
elenatorro Nov 28, 2019
ef6aa53
Use classes on pre tag
elenatorro Nov 28, 2019
619a0e1
Unify code responses
elenatorro Nov 28, 2019
450d3bf
Add provisional content sections
elenatorro Nov 28, 2019
e914590
Use --pre example at the beginning
elenatorro Nov 28, 2019
7bd3df9
Merge branch 'develop' into guides/review
elenatorro Nov 28, 2019
3b332cd
Rename guides
elenatorro Nov 28, 2019
ef3bede
Fix links
elenatorro Nov 28, 2019
c9229c2
Remove from new-guides
elenatorro Nov 28, 2019
87d3bfc
Change content links order
elenatorro Nov 28, 2019
2a8c04d
Fix cell reponses
elenatorro Nov 28, 2019
77ff312
Update guides introduction titles and descriptions
cmongut Nov 28, 2019
21b15d4
Merge branch 'guides/review' of github.com:CartoDB/cartoframes into g…
cmongut Nov 28, 2019
c835f1a
Update Quickstart headings
cmongut Nov 28, 2019
dddbfbe
Update guides titles
cmongut Nov 28, 2019
d42dbbf
Update old guides links
cmongut Nov 28, 2019
934a7ac
financial discovery
Nov 28, 2019
5b4a64b
remove geom_coverage from to_dict
Nov 28, 2019
a2aae03
fix test
Nov 28, 2019
4dc9498
fix format
Nov 28, 2019
3149499
remove import
Nov 28, 2019
68227f7
fix style
Nov 28, 2019
c2a3f33
Update Introduction, Authentication and Quickstart copies
cmongut Nov 29, 2019
e67b1ce
enrichment guide first version
Nov 29, 2019
46b931c
Fix typo in installation guide
cmongut Nov 29, 2019
2eb996a
Merge pull request #1272 from CartoDB/discovery_financial
alrocar Nov 29, 2019
ba61303
Merge branch 'develop' of https://github.com/CartoDB/cartoframes into…
Nov 29, 2019
0ccc18c
fixes and add guide
Nov 29, 2019
a499016
Merge pull request #1275 from CartoDB/enrichment_guide
alrocar Nov 29, 2019
0c7e0ee
minor fixes
Nov 29, 2019
bdbb6df
Merge branch 'guides/review' of https://github.com/CartoDB/cartoframe…
Nov 29, 2019
d4af004
minor fixes
Nov 29, 2019
6900015
fix style
Nov 29, 2019
7570468
add file
Nov 29, 2019
d5f8677
remove creds
Nov 29, 2019
ad3ccdb
merge develop
Nov 29, 2019
4baf7b8
add vertical scroll
Nov 29, 2019
295b607
agg options reference improvement
simon-contreras-deel Nov 29, 2019
7b28e19
agg options reference styles
simon-contreras-deel Nov 29, 2019
9582374
agg options reference styles 2
simon-contreras-deel Nov 29, 2019
dfaf941
Change credentials.json with creds.json in the quickstart
cmongut Nov 29, 2019
75ac4d2
Update enrichment guide titles and links
cmongut Nov 29, 2019
c537092
Merge branch 'develop' into guides/review
Jesus89 Nov 29, 2019
879e959
Keep CDF after a slice filter
Jesus89 Nov 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cartoframes/core/cartodataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _constructor(self):

def __getitem__(self, key):
result = super(self._constructor, self).__getitem__(key)
if isinstance(key, (list, ndarray, Series)):
if isinstance(key, (list, slice, ndarray, Series)):
result.__class__ = self._constructor
return result

Expand Down
2 changes: 1 addition & 1 deletion cartoframes/data/observatory/catalog/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CatalogEntity(ABC):

id_field = 'id'
_entity_repo = None
export_excluded_fields = ['summary_json', 'available_in']
export_excluded_fields = ['summary_json', 'available_in', 'geom_coverage']

def __init__(self, data):
self.data = data
Expand Down
14 changes: 8 additions & 6 deletions cartoframes/data/observatory/enrichment/enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Enrichment(EnrichmentService):
def __init__(self, credentials=None):
super(Enrichment, self).__init__(credentials)

def enrich_points(self, dataframe, variables, geom_col=None, filters={}):
def enrich_points(self, dataframe, variables, geom_col=None, filters=[]):
"""Enrich your points `DataFrame` with columns (:obj:`Variable`) from one or more :obj:`Dataset`
in the Data Observatory, intersecting the points in the source `DataFrame` with the geographies in the
Data Observatory.
Expand Down Expand Up @@ -127,8 +127,7 @@ def enrich_points(self, dataframe, variables, geom_col=None, filters={}):
AGGREGATION_NONE = AGGREGATION_NONE
"""Do not aggregate data in polygons enrichment. More info in :py:attr:`Enrichment.enrich_polygons`"""

def enrich_polygons(self, dataframe, variables, geom_col=None, filters=[],
aggregation=AGGREGATION_DEFAULT):
def enrich_polygons(self, dataframe, variables, geom_col=None, filters=[], aggregation=AGGREGATION_DEFAULT):
"""Enrich your polygons `DataFrame` with columns (:obj:`Variable`) from one or more :obj:`Dataset` in
the Data Observatory by intersecting the polygons in the source `DataFrame` with geographies in the
Data Observatory.
Expand Down Expand Up @@ -160,13 +159,16 @@ def enrich_polygons(self, dataframe, variables, geom_col=None, filters=[],

The options are:
- :py:attr:`Enrichment.AGGREGATION_DEFAULT` (default): Every :obj:`Variable` has a default
aggregation method in the :py:attr:`Variable.agg_method` property and it will be used to aggregate
the data (a variable could not have `agg_method` defined and in this case, the variables will be
skipped).
aggregation method in the :py:attr:`Variable.agg_method` property and it will be used to
aggregate the data (a variable could not have `agg_method` defined and in this case, the
variables will be skipped).

- :py:attr:`Enrichment.AGGREGATION_NONE`: use this option to do the aggregation locally by yourself.
You will receive a row of data from each polygon instersected.

- str: if you want to overwrite every default aggregation method, you can pass a string with the
aggregation method to use.

- dictionary: if you want to overwrite some default aggregation methods from your selected
variables, use a dict as :py:attr:`Variable.id`: aggregation method pairs, for example:
`{variable1.id: 'SUM', variable3.id: 'AVG'}`.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/io/dataset_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def update(self, privacy=None, table_name=None):
if modified:
self._save_metadata()

def _get_metadata(self, auth_client, table_name, retries=3, retry_wait_time=1):
def _get_metadata(self, auth_client, table_name, retries=4, retry_wait_time=1):
ds_manager = DatasetManager(auth_client)
try:
return ds_manager.get(table_name)
Expand Down
45 changes: 35 additions & 10 deletions docs/developer-center/guides/01-Introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Introduction

Use these guides to learn about integrating CARTOframes into your data science workflows. Working inside of a Jupyter Notebook, the guides walk through initial set-up and installation, login to CARTO platform, reading data from CARTO into your Python session, writing data to your CARTO account, and the basics of visualizing your data on a map.
Use these guides to learn about integrating CARTOframes into your data science workflows. Working inside of a Jupyter Notebook, the guides walk through installation, visualization, authentication, data enrichment and location data services.

If you're already familiar with Jupyter Notebooks, you can also take a look to our [Notebook Examples](/developers/cartoframes/examples) for more detailed use cases.

Expand All @@ -9,31 +9,56 @@ If you're already familiar with Jupyter Notebooks, you can also take a look to o
<div class="doc-guides__cartoframes-row">
<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Install-CARTOframes-in-your-Notebooks/">Installation</a>
<a href="/developers/cartoframes/guides/Quickstart/">Quickstart</a>
</span>
<p class="doc-guides__description">This guide walks you through the process of installing CARTOframes in a Jupyter Notebook</p>
<p class="doc-guides__description">Complete a real project that walks through the library step by step</p>
</div>

<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Login-to-CARTO-Platform/">Login into CARTO</a>
<a href="/developers/cartoframes/guides/Installation/">Installation</a>
</span>
<p class="doc-guides__description">Learn how to authenticate against CARTO</p>
<p class="doc-guides__description">Install the library and configure your environment</p>
</div>
</div>

<div class="doc-guides__cartoframes-row">
<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Quickstart-Part-1/">Quickstart Part 1</a>
<a href="/developers/cartoframes/guides/Authentication/">Authentication</a>
</span>
<p class="doc-guides__description">From import to first visualization</p>
<p class="doc-guides__description">Login into CARTO to unlock the power of spatial anlysis (data management, data enrichment, location data services, etc)</p>
</div>

<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Quickstart-Part-2/">Quickstart Part 2</a>
<a href="/developers/cartoframes/guides/Visualization/">Visualization</a>
</span>
<p class="doc-guides__description">From analysis to share a visualization</p>
<p class="doc-guides__description">Explore and visualize your spatial data with interactive maps</p>
</div>
</div>
</div>

<div class="doc-guides__cartoframes-row">
<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Data-discovery/">Data discovery</a>
</span>
<p class="doc-guides__description">Discover the spatial data you need searching the data catalog</p>
</div>

<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Data-enrichment/">Data enrichment</a>
</span>
<p class="doc-guides__description">Enrich your data with data from the data catalog</p>
</div>
</div>

<div class="doc-guides__cartoframes-row">
<div class="doc-guides__cartoframes-block">
<span class="doc-guides__title">
<a href="/developers/cartoframes/guides/Location-Data-Services/">Location Data Services</a>
</span>
<p class="doc-guides__description">Geocode and discover areas of influence with Isolines</p>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
## Install CARTOframes in your Notebooks
## Installation

This guide is intended for those who are going to start using CARTOframes and gives some instructions to install CARTOframes **locally**, in a **Jupyter Notebook** and using a **Virtual Environment**.

### Install CARTOframes using `pip`

It is possible to install CARTOframes with [`pip`](https://pypi.org/project/pip/) by simply typing the following in the command line to do a system install:
It is possible to install CARTOframes with [`pip`](https://pypi.org/project/pip/) by simply typing one of the following commands to do a system install:

To install the latest beta release, use the `--pre` flag:

```bash
$ pip install cartoframes
$ pip install cartoframes --pre
```

To install a specific version, for example, let's say the 1.2.3 version:
To install the latest stable version:

```bash
$ pip install cartoframes==1.2.3
$ pip install cartoframes
```

To install a pre release, use the `--pre` flag:
To install a specific version, for example, let's say the 1.0b6 version:

```bash
$ pip install cartoframes --pre
$ pip install cartoframes==1.0b6
```


### Install CARTOframes in a Jupyter Notebook

In this documentation, all the examples are in a [Jupyter Notebook](https://jupyter.org/). It is recommended to read the [beginner documentation](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html) to get familiar with Jupyter. To install through a Jupyter Notebook, run this command:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Login to CARTO Platform
## Authentication

In this guide, our purpose is to focus on the basics of authentication in CARTOframes. There's a full [Authorization Fundamentals](https://carto.com/developers/fundamentals/authorization/) at CARTO guide to understand how to configure and manage API Keys.

> To use CARTOframes is *not always* needed to be authenticated.
> To visualize local data with CARTOframes is not needed to be authenticated.

It is needed to set up the user credentials to use Data Services or the Data Observatory, between others. In these cases, it's required to have a [CARTO account](https://carto.com/signup/). Once the user has created an account, the credentials can be found at **http://johnsmith.carto.com/your_apps.** for user `johnsmith`, and it should be a **Master** API Key:
It is needed to set up the user credentials to use Location Data Services, the Data Observatory or to save data and visualizations. In these cases, it's required to have a [CARTO account](https://carto.com/signup/). Once the user has created an account, the credentials can be found at **http://johnsmith.carto.com/your_apps.** for user `johnsmith`, and it should be a **Master** API Key:

![Master API Key - CARTO Dashboard](../../img/guides/credentials/api-keys.png)

Expand Down
165 changes: 0 additions & 165 deletions docs/developer-center/guides/04-Quickstart-Part-1.md

This file was deleted.

Loading