GeoPandas

1.1.3 · active · verified Sun Apr 05

GeoPandas extends the popular Python data analysis library pandas by adding support for geographic data. It introduces GeoSeries and GeoDataFrame types, which are subclasses of pandas.Series and pandas.DataFrame, respectively, allowing for the manipulation and analysis of geometric objects. GeoPandas is currently at version 1.1.3, with frequent patch releases addressing compatibility and bug fixes, and major releases periodically introducing significant changes and dependency updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to load a built-in geospatial dataset using `geodatasets` and `gpd.read_file()`, inspect its basic properties (like the first few rows and Coordinate Reference System), and create a simple static map using the `.plot()` method.

import geopandas as gpd
import geodatasets
import matplotlib.pyplot as plt

# Load a sample dataset (New York City boroughs)
path = geodatasets.get_path('ny.bb')
nybb = gpd.read_file(path)

print("GeoDataFrame Head:")
print(nybb.head())

print("\nCoordinate Reference System (CRS):")
print(nybb.crs)

# Plot the GeoDataFrame
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
nybb.plot(ax=ax, color='lightgray', edgecolor='black')
ax.set_title('New York City Boroughs')
plt.show()

view raw JSON →