mirror of
https://github.com/wassname/geopandas.git
synced 2026-10-04 12:40:08 +08:00
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:
1 parent
c5d48ecf5d
commit
8f4889affd
1 file changed
+19
@@ -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"]
|
||||
|
||||
Reference in new issue
Block a user