pandera.typing.geopandas.GeoDataFrame¶
- class pandera.typing.geopandas.GeoDataFrame(data=None, *args, geometry=None, crs=None, **kwargs)[source]¶
A generic type for geopandas.GeoDataFrame.
Attributes
TThe transpose of the DataFrame.
active_geometry_nameReturn the name of the active geometry column.
areaReturn a
Seriescontaining the area of each geometry in theGeoSeriesexpressed in the units of the CRS.atAccess a single value for a row/column label pair.
attrsDictionary of global attributes of this dataset.
axesReturn a list representing the axes of the DataFrame.
boundaryReturn a
GeoSeriesof lower dimensional objects representing each geometry's set-theoretic boundary.boundsReturn a
DataFramewith columnsminx,miny,maxx,maxyvalues containing the bounds for each geometry.centroidReturn a
GeoSeriesof points representing the centroid of each geometry.columnsThe column labels of the DataFrame.
convex_hullReturn a
GeoSeriesof geometries representing the convex hull of each geometry.crsThe Coordinate Reference System (CRS) represented as a
pyproj.CRSobject.cxCoordinate based indexer to select by intersection with bounding box.
default_dtypedtypesReturn the dtypes in the DataFrame.
emptyIndicator whether Series/DataFrame is empty.
envelopeReturn a
GeoSeriesof geometries representing the envelope of each geometry.exteriorReturn a
GeoSeriesof LinearRings representing the outer boundary of each polygon in the GeoSeries.flagsGet the properties associated with this pandas object.
geom_typeReturns a
Seriesof strings specifying the Geometry Type of each object.geometryGeometry data for GeoDataFrame
has_mReturn a
Seriesofdtype('bool')with valueTruefor features that have a m-component.has_sindexCheck the existence of the spatial index without generating it.
has_zReturn a
Seriesofdtype('bool')with valueTruefor features that have a z-component.iatAccess a single value for a row/column pair by integer position.
ilocPurely integer-location based indexing for selection by position.
indexThe index (row labels) of the DataFrame.
interiorsReturn a
Seriesof List representing the inner rings of each polygon in the GeoSeries.is_ccwReturn a
Seriesofdtype('bool')with valueTrueif a LineString or LinearRing is counterclockwise.is_closedReturn a
Seriesofdtype('bool')with valueTrueif a LineString's or LinearRing's first and last points are equal.is_emptyReturns a
Seriesofdtype('bool')with valueTruefor empty geometries.is_ringReturn a
Seriesofdtype('bool')with valueTruefor features that are closed.is_simpleReturn a
Seriesofdtype('bool')with valueTruefor geometries that do not cross themselves.is_validReturn a
Seriesofdtype('bool')with valueTruefor geometries that are valid.lengthReturn a
Seriescontaining the length of each geometry expressed in the units of the CRS.locAccess a group of rows and columns by label(s) or a boolean array.
ndimReturn an int representing the number of axes / array dimensions.
shapeReturn a tuple representing the dimensionality of the DataFrame.
sindexGenerate the spatial index.
sizeReturn an int representing the number of elements in this object.
styleReturns a Styler object.
total_boundsReturn a tuple containing
minx,miny,maxx,maxyvalues for the bounds of the series as a whole.typeReturn the geometry type of each geometry in the GeoSeries.
unary_unionReturn a geometry containing the union of all geometries in the
GeoSeries.valuesReturn a Numpy representation of the DataFrame.
Methods
- copy(deep=True)[source]¶
Copy that avoids
__class__reassignment to this subclass.Geopandas >= 1.1 reassigns
__class__totype(self)insidecopy(). That fails for this pandera subclass because its C-level layout is incompatible withpd.DataFrame. We replicate the geopandas logic but targetgpd.GeoDataFrameinstead.- Return type:
GeoDataFrame
- classmethod from_format(obj, config)[source]¶
Converts serialized data from a specific format specified in the
pandera.api.pandas.model.DataFrameModelorpandera.geopandas.GeoDataFrameModelconfig optionsfrom_formatandfrom_format_kwargs.- Parameters:
obj (
Any) – object representing a serialized dataframe.config – dataframe model configuration object.
- Return type:
GeoDataFrame
- classmethod pydantic_validate(obj, schema_model)[source]¶
Verify that the input can be converted into a pandas dataframe that meets all schema requirements.
This is for pydantic >= v2
- Return type:
GeoDataFrame
- classmethod to_format(data, config)[source]¶
Converts a geodataframe to the format specified in the
pandera.api.pandas.model.DataFrameModelorpandera.geopandas.GeoDataFrameModelconfig optionsto_formatandto_format_kwargs.- Parameters:
data (
GeoDataFrame) – convert this data to the specified formatconfig – :py:cl
- Return type: