DOC: Add example in GeoDataFrame docstring (#1456)

* add example in GeoDataFrame docstring

* Update GeoDataFrame docstring

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
This commit is contained in:
abonteandMartin Fleischmann authored and GitHub committed 2020-05-31 10:16:38 +01:00
1 parent c5d48ecf5d
commit 8f4889affd
1 file changed
+19
+19
View File
@@ -58,6 +58,25 @@ class GeoDataFrame(GeoPandasBase, DataFrame):
geometry : str or array (optional)
If str, column to use as geometry. If array, will be set as 'geometry'
column on GeoDataFrame.
Examples
--------
Constructing GeoDataFrame from a dictionary.
>>> d = {'col1': ['name1', 'name2'],
... 'geometry': [shapely.geometry.Point(1,2), shapely.geometry.Point(2,1)]}
>>> gdf = gpd.GeoDataFrame(d, crs="EPSG:4326")
>>> gdf
col1 geometry
0 name1 POINT (1.00000 2.00000)
1 name2 POINT (2.00000 1.00000)
Notice that the inferred dtype of 'geometry' columns is geometry.
>>> gdf.dtypes
col1 object
geometry geometry
dtype: object
"""
_metadata = ["_crs", "_geometry_column_name"]