geopandas.GeoSeries.from_xy

classmethod GeoSeries.from_xy(x, y, z=None, index=None, crs=None, **kwargs)

Alternate constructor to create a GeoSeries of Point geometries from lists or arrays of x, y(, z) coordinates

In case of geographic coordinates, it is assumed that longitude is captured by x coordinates and latitude by y.

Parameters
x, y, ziterable
indexarray-like or Index, optional

The index for the GeoSeries. If not given and all coordinate inputs are Series with an equal index, that index is used.

crsvalue, optional

Coordinate Reference System of the geometry objects. Can be anything accepted by pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:4326”) or a WKT string.

**kwargs

Additional arguments passed to the Series constructor, e.g. name.

Returns
GeoSeries

Examples

>>> x = [2.5, 5, -3.0]
>>> y = [0.5, 1, 1.5]
>>> s = geopandas.GeoSeries.from_xy(x, y, crs="EPSG:4326")
>>> s
0    POINT (2.50000 0.50000)
1    POINT (5.00000 1.00000)
2    POINT (-3.00000 1.50000)
dtype: geometry