-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1130 from CartoDB/carto-data-frame
Add CartoDataFrame class
- Loading branch information
Showing
85 changed files
with
4,342 additions
and
4,600 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
__title__ = 'cartoframes' | ||
__description__ = 'CARTO Python package for data scientists' | ||
__version__ = '1.0b5' | ||
__url__ = 'https://github.com/CartoDB/cartoframes' | ||
__author__ = 'Andy Eschbacher' | ||
__email__ = 'andy@carto.com' | ||
__license__ = 'BSD' | ||
from ._version import __version__ | ||
from .core.cartodataframe import CartoDataFrame | ||
from .io.carto import read_carto, to_carto, has_table, delete_table, describe_table, \ | ||
update_table, copy_table, create_table_from_query | ||
|
||
|
||
__all__ = [ | ||
'__version__', | ||
'CartoDataFrame', | ||
'read_carto', | ||
'to_carto', | ||
'has_table', | ||
'delete_table', | ||
'describe_table', | ||
'update_table', | ||
'copy_table', | ||
'create_table_from_query' | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '1.0b5' |
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
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from geopandas import GeoDataFrame | ||
|
||
from ..utils.geom_utils import generate_index, generate_geometry | ||
|
||
|
||
class CartoDataFrame(GeoDataFrame): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(CartoDataFrame, self).__init__(*args, **kwargs) | ||
|
||
@staticmethod | ||
def from_carto(*args, **kwargs): | ||
from ..io.carto import read_carto | ||
return read_carto(*args, **kwargs) | ||
|
||
@classmethod | ||
def from_file(cls, filename, **kwargs): | ||
gdf = GeoDataFrame.from_file(filename, **kwargs) | ||
return cls(gdf) | ||
|
||
@classmethod | ||
def from_features(cls, features, **kwargs): | ||
gdf = GeoDataFrame.from_features(features, **kwargs) | ||
return cls(gdf) | ||
|
||
def to_carto(self, *args, **kwargs): | ||
from ..io.carto import to_carto | ||
return to_carto(self, *args, **kwargs) | ||
|
||
def convert(self, index_column=None, geom_column=None, lnglat_columns=None, | ||
drop_index=True, drop_geom=True, drop_lnglat=True): | ||
# Magic function | ||
generate_index(self, index_column, drop_index) | ||
generate_geometry(self, geom_column, lnglat_columns, drop_geom, drop_lnglat) | ||
return self | ||
|
||
def viz(self, *args, **kwargs): | ||
from ..viz import Map, Layer | ||
return Map(Layer(self, *args, **kwargs)) |
File renamed without changes.
Oops, something went wrong.