GeoArrow Pandas

0.1.1 · active · verified Fri Apr 17

GeoArrow Pandas provides GeoArrow extension types for pandas DataFrames, enabling efficient storage and manipulation of geospatial data using the Apache Arrow memory format. It integrates with pandas by implementing the ExtensionArray and ExtensionDtype protocols. The current version is 0.1.1, and it is considered an experimental library with a relatively slow release cadence, indicating ongoing development.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a pandas Series using GeoArrow extension types, specifically the Well-Known Binary (WKB) format. It uses `shapely` to construct geometries and `ga.wkb_type()` to specify the GeoArrow dtype. The series will behave like a regular pandas Series but with GeoArrow's efficient backing.

import pandas as pd
import geoarrow.pandas as ga
import shapely

# Create a pandas Series with GeoArrow-backed WKB geometries
s = pd.Series([shapely.Point(1, 2), shapely.Point(3, 4)], dtype=ga.wkb_type())

print("GeoArrow-backed Series:")
print(s)
print(f"Series dtype: {s.dtype}")

# Example conversion to GeoPandas
# geopandas dependency would be needed for actual usage:
# try:
#     import geopandas
#     gdf = ga.to_geopandas(s.to_frame(name='geometry'))
#     print('\nConverted to GeoPandas GeoDataFrame:')
#     print(gdf)
# except ImportError:
#     print('\nSkipping GeoPandas conversion (geopandas not installed).')

view raw JSON →