Skip to content

Commit e9074b7

Browse files
authored
Merge pull request #297 from CartoDB/v0.4.0b6
v0.4.0b6
2 parents 7c53ea6 + 16aab1e commit e9074b7

33 files changed

+669
-352
lines changed

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
===========
2-
CARTOFrames
2+
CARTOframes
33
===========
44

55
.. image:: https://travis-ci.org/CartoDB/cartoframes.svg?branch=master
@@ -12,7 +12,7 @@ CARTOFrames
1212

1313
A Python package for integrating `CARTO <https://carto.com/>`__ maps, analysis, and data services into data science workflows.
1414

15-
Python data analysis workflows often rely on the de facto standards `pandas <http://pandas.pydata.org/>`__ and `Jupyter notebooks <http://jupyter.org/>`__. Integrating CARTO into this workflow saves data scientists time and energy by not having to export datasets as files or retain multiple copies of the data. Instead, CARTOFrames give the ability to communicate reproducible analysis while providing the ability to gain from CARTO's services like hosted, dynamic or static maps and `Data Observatory <https://carto.com/data-observatory/>`__ augmentation.
15+
Python data analysis workflows often rely on the de facto standards `pandas <http://pandas.pydata.org/>`__ and `Jupyter notebooks <http://jupyter.org/>`__. Integrating CARTO into this workflow saves data scientists time and energy by not having to export datasets as files or retain multiple copies of the data. Instead, CARTOframes give the ability to communicate reproducible analysis while providing the ability to gain from CARTO's services like hosted, dynamic or static maps and `Data Observatory <https://carto.com/data-observatory/>`__ augmentation.
1616

1717
Features
1818

@@ -38,7 +38,7 @@ To install `cartoframes` (currently in beta) on your machine, do the following t
3838

3939
.. code:: bash
4040
41-
$ pip install --pre cartoframes
41+
$ pip install cartoframes
4242
4343
It is recommended to use `cartoframes` in Jupyter Notebooks (`pip install jupyter`). See the example usage section below or notebooks in the `examples directory <https://github.com/CartoDB/cartoframes/tree/master/examples>`__ for using `cartoframes` in that environment.
4444

@@ -51,7 +51,7 @@ To setup `cartoframes` and `Jupyter` in a `virtual environment <http://python-gu
5151
5252
$ virtualenv venv
5353
$ source venv/bin/activate
54-
(venv) $ pip install --pre cartoframes
54+
(venv) $ pip install cartoframes
5555
(venv) $ pip install jupyter
5656
(venv) $ jupyter notebook
5757

cartoframes/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.3.0b5'
1+
__version__ = '0.4.0b6'

cartoframes/context.py

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
from carto.sql import SQLClient, BatchSQLClient
1919
from carto.exceptions import CartoException
2020

21-
from .credentials import Credentials
22-
from .dataobs import get_countrytag
23-
from . import utils
24-
from .layer import BaseMap
25-
from .maps import non_basemap_layers, get_map_name, get_map_template
26-
from .__version__ import __version__
21+
from cartoframes.credentials import Credentials
22+
from cartoframes.dataobs import get_countrytag
23+
from cartoframes import utils
24+
from cartoframes.layer import BaseMap
25+
from cartoframes.maps import non_basemap_layers, get_map_name, get_map_template
26+
from cartoframes.__version__ import __version__
2727

2828
if sys.version_info >= (3, 0):
2929
from urllib.parse import urlparse, urlencode
@@ -74,9 +74,10 @@ class CartoContext(object):
7474
7575
Args:
7676
base_url (str): Base URL of CARTO user account. Cloud-based accounts
77-
are of the form ``https://{username}.carto.com`` (e.g.,
78-
https://eschbacher.carto.com for user ``eschbacher``). On-premises
79-
installation users should ask their admin.
77+
should use the form ``https://{username}.carto.com`` (e.g.,
78+
https://eschbacher.carto.com for user ``eschbacher``) whether on
79+
a personal or multi-user account. On-premises installation users
80+
should ask their admin.
8081
api_key (str): CARTO API key.
8182
session (requests.Session, optional): requests session. See `requests
8283
documentation
@@ -186,7 +187,8 @@ def write(self, df, table_name, temp_dir=CACHE_DIR,
186187
CARTO account
187188
table_name (str): Table to write ``df`` to in CARTO.
188189
temp_dir (str, optional): Directory for temporary storage of data
189-
that is sent to CARTO. Default is ``/tmp`` (Unix-like systems).
190+
that is sent to CARTO. Defaults are defined by `appdirs
191+
<https://github.com/ActiveState/appdirs/blob/master/README.rst>`__.
190192
overwrite (bool, optional): Behavior for overwriting ``table_name``
191193
if it exits on CARTO. Defaults to ``False``.
192194
lnglat (tuple, optional): lng/lat pair that can be used for
@@ -207,7 +209,9 @@ def write(self, df, table_name, temp_dir=CACHE_DIR,
207209
`content_guessing='true'`, a column named 'countries' with
208210
country names will be used to generate polygons for each
209211
country. To avoid unintended consequences, avoid `file`, `url`,
210-
and other similar arguments.
212+
and other similar arguments. Note: Combining `privacy` with
213+
`overwrite` (defined above) does not currently update the
214+
privacy of a dataset: https://github.com/CartoDB/cartoframes/issues/252.
211215
212216
Returns:
213217
:obj:`BatchJobStatus` or None: If `lnglat` flag is set and the
@@ -1064,15 +1068,16 @@ def data_discovery(self, region, keywords=None, regex=None, time=None,
10641068
For example, setting the region to be United States counties with
10651069
no filter values set will result in many thousands of measures.
10661070
1067-
Example:
1071+
Examples:
10681072
1069-
Get all European Union measures that mention ``freight``.
1070-
.. code::
1073+
Get all European Union measures that mention ``freight``.
1074+
1075+
.. code::
10711076
1072-
meta = cc.data_discovery('European Union',
1073-
keywords='freight',
1074-
time='2010')
1075-
print(meta['numer_name'].values)
1077+
meta = cc.data_discovery('European Union',
1078+
keywords='freight',
1079+
time='2010')
1080+
print(meta['numer_name'].values)
10761081
10771082
Arguments:
10781083
region (str or list of float): Information about the region of
@@ -1319,14 +1324,15 @@ def data(self, table_name, metadata, persist_as=None, how='the_geom'):
13191324
persist_as (str, optional): Output the results of augmenting
13201325
`table_name` to `persist_as` as a persistent table on CARTO.
13211326
Defaults to ``None``, which will not create a table.
1322-
how (str, optional): Column name for identifying the geometry from
1323-
which to fetch the data. Defaults to `the_geom`, which results
1324-
in measures that are spatially interpolated (e.g., a
1325-
neighborhood boundary's population will be calculated from
1326-
underlying census tracts). Specifying a column that has the
1327-
geometry identifier (for example, GEOID for US Census
1328-
boundaries), results in measures directly from the Census for
1329-
that GEOID but normalized how it is specified in the metadata.
1327+
how (str, optional): **Not fully implemented**. Column name for
1328+
identifying the geometry from which to fetch the data. Defaults
1329+
to `the_geom`, which results in measures that are spatially
1330+
interpolated (e.g., a neighborhood boundary's population will
1331+
be calculated from underlying census tracts). Specifying a
1332+
column that has the geometry identifier (for example, GEOID for
1333+
US Census boundaries), results in measures directly from the
1334+
Census for that GEOID but normalized how it is specified in the
1335+
metadata.
13301336
13311337
Returns:
13321338
pandas.DataFrame: A DataFrame representation of `table_name` which
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cartoframes\.dataobs module
2+
===========================
3+
4+
.. automodule:: cartoframes.dataobs
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/_sources/cartoframes.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Submodules
88

99
cartoframes.context
1010
cartoframes.credentials
11+
cartoframes.dataobs
1112
cartoframes.layer
1213
cartoframes.maps
1314
cartoframes.styling

docs/_sources/index.rst.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,15 @@
77

88
.. toctree::
99
:maxdepth: 2
10-
:caption: Contents:
1110

12-
modules
13-
14-
CARTOFrames Functionality
11+
CARTOframes Functionality
1512
=========================
1613

1714
CartoContext
1815
------------
1916
.. autoclass:: context.CartoContext
2017
:member-order: bysource
21-
:members: read, query, delete, map, data_augment
18+
:members: read, query, delete, map, data_discovery, data
2219

2320
.. automethod:: write(df, table_name, temp_dir=SYSTEM_TMP_PATH, overwrite=False, lnglat=None, encode_geom=False, geom_col=None, \*\*kwargs)
2421

0 commit comments

Comments
 (0)