geopandas.
GeoSeries
A Series object designed to store shapely geometry objects.
The geometries to store in the GeoSeries.
The index for the GeoSeries.
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.
pyproj.CRS.from_user_input()
e.g. name.
name
See also
GeoDataFrame
pandas.Series
Examples
>>> from shapely.geometry import Point >>> s = geopandas.GeoSeries([Point(1, 1), Point(2, 2), Point(3, 3)]) >>> s 0 POINT (1 1) 1 POINT (2 2) 2 POINT (3 3) dtype: geometry
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(self, \*args, \*\*kwargs)
Initialize self.
abs(self)
abs
Return a Series/DataFrame with absolute numeric value of each element.
add(self, other[, level, fill_value, axis])
add
Return Addition of series and other, element-wise (binary operator add).
add_prefix(self, prefix)
add_prefix
Prefix labels with string prefix.
add_suffix(self, suffix)
add_suffix
Suffix labels with string suffix.
affine_transform(self, matrix)
affine_transform
Return a GeoSeries with translated geometries.
agg(self, func[, axis])
agg
Aggregate using one or more operations over the specified axis.
aggregate(self, func[, axis])
aggregate
align(self, other[, join, axis, level, …])
align
Align two objects on their axes with the specified join method.
all(self[, axis, bool_only, skipna, level])
all
Return whether all elements are True, potentially over an axis.
any(self[, axis, bool_only, skipna, level])
any
Return whether any element is True, potentially over an axis.
append(self, \*args, \*\*kwargs)
append
Concatenate two or more Series.
apply(self, func[, args])
apply
Invoke function on values of Series.
argmax(self[, axis, skipna])
argmax
Return an ndarray of the maximum argument indexer.
argmin(self[, axis, skipna])
argmin
Return a ndarray of the minimum argument indexer.
argsort(self[, axis, kind, order])
argsort
Override ndarray.argsort.
asfreq(self, freq[, method, fill_value])
asfreq
Convert TimeSeries to specified frequency.
asof(self, where[, subset])
asof
Return the last row(s) without any NaNs before where.
astype(self, dtype, copy, errors)
astype
Cast a pandas object to a specified dtype dtype.
dtype
at_time(self, time, asof[, axis])
at_time
Select values at particular time of day (e.g.
autocorr(self[, lag])
autocorr
Compute the lag-N autocorrelation.
between(self, left, right[, inclusive])
between
Return boolean Series equivalent to left <= series <= right.
between_time(self, start_time, end_time, …)
between_time
Select values between particular times of the day (e.g., 9:00-9:30 AM).
bfill(self[, axis, limit, downcast])
bfill
Synonym for DataFrame.fillna() with method='bfill'.
DataFrame.fillna()
method='bfill'
bool(self)
bool
Return the bool of a single element PandasObject.
buffer(self, distance[, resolution])
buffer
Returns a GeoSeries of geometries representing all points within a given distance of each geometric object.
clip(self[, lower, upper, axis])
clip
Trim values at input threshold(s).
combine(self, other, func[, fill_value])
combine
Combine the Series with a Series or scalar according to func.
combine_first(self, other)
combine_first
Combine Series values, choosing the calling Series’s values first.
contains(self, other)
contains
Returns a Series of dtype('bool') with value True for each geometry that contains other.
Series
dtype('bool')
True
convert_dtypes(self, infer_objects, …)
convert_dtypes
Convert columns to best possible dtypes using dtypes supporting pd.NA.
pd.NA
copy(self, deep)
copy
Make a copy of this object’s indices and data.
corr(self, other[, method, min_periods])
corr
Compute correlation with other Series, excluding missing values.
count(self[, level])
count
Return number of non-NA/null observations in the Series.
cov(self, other[, min_periods])
cov
Compute covariance with Series, excluding missing values.
covered_by(self, other)
covered_by
Returns a Series of dtype('bool') with value True for each geometry that is entirely covered by other.
covers(self, other)
covers
Returns a Series of dtype('bool') with value True for each geometry that is entirely covering other.
crosses(self, other)
crosses
Returns a Series of dtype('bool') with value True for each geometry that cross other.
cummax(self[, axis, skipna])
cummax
Return cumulative maximum over a DataFrame or Series axis.
cummin(self[, axis, skipna])
cummin
Return cumulative minimum over a DataFrame or Series axis.
cumprod(self[, axis, skipna])
cumprod
Return cumulative product over a DataFrame or Series axis.
cumsum(self[, axis, skipna])
cumsum
Return cumulative sum over a DataFrame or Series axis.
describe(self[, percentiles, include, exclude])
describe
Generate descriptive statistics.
diff(self[, periods])
diff
First discrete difference of element.
difference(self, other)
difference
Returns a GeoSeries of the points in each geometry that are not in other.
disjoint(self, other)
disjoint
Returns a Series of dtype('bool') with value True for each geometry disjoint to other.
distance(self, other)
distance
Returns a Series containing the distance to other.
div(self, other[, level, fill_value, axis])
div
Return Floating division of series and other, element-wise (binary operator truediv).
divide(self, other[, level, fill_value, axis])
divide
divmod(self, other[, level, fill_value, axis])
divmod
Return Integer division and modulo of series and other, element-wise (binary operator divmod).
dot(self, other)
dot
Compute the dot product between the Series and the columns of other.
drop(self[, labels, axis, index, columns, …])
drop
Return Series with specified index labels removed.
drop_duplicates(self[, keep, inplace])
drop_duplicates
Return Series with duplicate values removed.
droplevel(self, level[, axis])
droplevel
Return DataFrame with requested index / column level(s) removed.
dropna(self[, axis, inplace, how])
dropna
Return a new Series with missing values removed.
duplicated(self[, keep])
duplicated
Indicate duplicate Series values.
eq(self, other[, level, fill_value, axis])
eq
Return Equal to of series and other, element-wise (binary operator eq).
equals(self, other)
equals
Test whether two objects contain the same elements.
ewm(self[, com, span, halflife, alpha, …])
ewm
Provide exponential weighted functions.
expanding(self[, min_periods, center, axis])
expanding
Provide expanding transformations.
explode(self)
explode
Explode multi-part geometries into multiple single geometries.
factorize(self[, sort, na_sentinel])
factorize
Encode the object as an enumerated type or categorical variable.
ffill(self[, axis, limit, downcast])
ffill
Synonym for DataFrame.fillna() with method='ffill'.
method='ffill'
fillna(self[, value, method, inplace])
fillna
Fill NA values with a geometry (empty polygon by default).
filter(self[, items, axis])
filter
Subset the dataframe rows or columns according to the specified index labels.
first(self, offset)
first
Method to subset initial periods of time series data based on a date offset.
first_valid_index(self)
first_valid_index
Return index for first non-NA/null value.
floordiv(self, other[, level, fill_value, axis])
floordiv
Return Integer division of series and other, element-wise (binary operator floordiv).
from_file(filename, \*\*kwargs)
from_file
Alternate constructor to create a GeoSeries from a file.
ge(self, other[, level, fill_value, axis])
ge
Return Greater than or equal to of series and other, element-wise (binary operator ge).
geom_almost_equals(self, other[, decimal])
geom_almost_equals
Returns a Series of dtype('bool') with value True if each geometry is approximately equal to other.
geom_equals(self, other)
geom_equals
Returns a Series of dtype('bool') with value True for each geometry equal to other.
geom_equals_exact(self, other, tolerance)
geom_equals_exact
Return True for all geometries that equal other to a given tolerance, else False
get(self, key[, default])
get
Get item from object for given key (ex: DataFrame column).
groupby(self[, by, axis, level])
groupby
Group Series using a mapper or by a Series of columns.
gt(self, other[, level, fill_value, axis])
gt
Return Greater than of series and other, element-wise (binary operator gt).
head(self, n)
head
Return the first n rows.
hist(self[, by, ax, grid, xlabelsize, xrot, …])
hist
Draw histogram of the input series using matplotlib.
idxmax(self[, axis, skipna])
idxmax
Return the row label of the maximum value.
idxmin(self[, axis, skipna])
idxmin
Return the row label of the minimum value.
infer_objects(self)
infer_objects
Attempt to infer better dtypes for object columns.
interpolate(self, distance[, normalized])
interpolate
Return a point at the specified distance along each geometry
intersection(self, other)
intersection
Returns a GeoSeries of the intersection of points in each geometry with other.
intersects(self, other)
intersects
Returns a Series of dtype('bool') with value True for each geometry that intersects other.
isin(self, values)
isin
Check whether values are contained in Series.
isna(self)
isna
Detect missing values.
isnull(self)
isnull
Alias for isna method.
item(self)
item
Return the first element of the underlying data as a python scalar.
items(self)
items
Lazily iterate over (index, value) tuples.
iteritems(self)
iteritems
keys(self)
keys
Return alias for index.
kurt(self[, axis, skipna, level, numeric_only])
kurt
Return unbiased kurtosis over requested axis.
kurtosis(self[, axis, skipna, level, …])
kurtosis
last(self, offset)
last
Method to subset final periods of time series data based on a date offset.
last_valid_index(self)
last_valid_index
Return index for last non-NA/null value.
le(self, other[, level, fill_value, axis])
le
Return Less than or equal to of series and other, element-wise (binary operator le).
lt(self, other[, level, fill_value, axis])
lt
Return Less than of series and other, element-wise (binary operator lt).
mad(self[, axis, skipna, level])
mad
Return the mean absolute deviation of the values for the requested axis.
map(self, arg[, na_action])
map
Map values of Series according to input correspondence.
mask(self, cond[, other, inplace, axis, …])
mask
Replace values where the condition is True.
max(self[, axis, skipna, level, numeric_only])
max
Return the maximum of the values for the requested axis.
mean(self[, axis, skipna, level, numeric_only])
mean
Return the mean of the values for the requested axis.
median(self[, axis, skipna, level, numeric_only])
median
Return the median of the values for the requested axis.
memory_usage(self[, index, deep])
memory_usage
Return the memory usage of the Series.
min(self[, axis, skipna, level, numeric_only])
min
Return the minimum of the values for the requested axis.
mod(self, other[, level, fill_value, axis])
mod
Return Modulo of series and other, element-wise (binary operator mod).
mode(self[, dropna])
mode
Return the mode(s) of the dataset.
mul(self, other[, level, fill_value, axis])
mul
Return Multiplication of series and other, element-wise (binary operator mul).
multiply(self, other[, level, fill_value, axis])
multiply
ne(self, other[, level, fill_value, axis])
ne
Return Not equal to of series and other, element-wise (binary operator ne).
nlargest(self[, n, keep])
nlargest
Return the largest n elements.
notna(self)
notna
Detect non-missing values.
notnull(self)
notnull
Alias for notna method.
nsmallest(self[, n, keep])
nsmallest
Return the smallest n elements.
nunique(self[, dropna])
nunique
Return number of unique elements in the object.
overlaps(self, other)
overlaps
Returns True for all geometries that overlap other, else False.
pct_change(self[, periods, fill_method, …])
pct_change
Percentage change between the current and a prior element.
pipe(self, func, \*args, \*\*kwargs)
pipe
Apply func(self, *args, **kwargs).
plot(self, \*args, \*\*kwargs)
plot
Plot a GeoSeries.
pop(self, item)
pop
Return item and drop from frame.
pow(self, other[, level, fill_value, axis])
pow
Return Exponential power of series and other, element-wise (binary operator pow).
prod(self[, axis, skipna, level, …])
prod
Return the product of the values for the requested axis.
product(self[, axis, skipna, level, …])
product
project(self, other[, normalized])
project
Return the distance along each geometry nearest to other
quantile(self[, q, interpolation])
quantile
Return value at the given quantile.
radd(self, other[, level, fill_value, axis])
radd
Return Addition of series and other, element-wise (binary operator radd).
rank(self[, axis])
rank
Compute numerical data ranks (1 through n) along axis.
ravel(self[, order])
ravel
Return the flattened underlying data as an ndarray.
rdiv(self, other[, level, fill_value, axis])
rdiv
Return Floating division of series and other, element-wise (binary operator rtruediv).
rdivmod(self, other[, level, fill_value, axis])
rdivmod
Return Integer division and modulo of series and other, element-wise (binary operator rdivmod).
reindex(self[, index])
reindex
Conform Series to new index with optional filling logic.
reindex_like(self, other, method, …[, …])
reindex_like
Return an object with matching indices as other object.
relate(self, other)
relate
Returns the DE-9IM intersection matrices for the geometries
rename(self[, index, axis, copy, inplace, …])
rename
Alter Series index labels or name.
rename_axis(self[, mapper, index, columns, …])
rename_axis
Set the name of the axis for the index or columns.
reorder_levels(self, order)
reorder_levels
Rearrange index levels using input order.
repeat(self, repeats[, axis])
repeat
Repeat elements of a Series.
replace(self[, to_replace, value, inplace, …])
replace
Replace values given in to_replace with value.
representative_point(self)
representative_point
Returns a GeoSeries of (cheaply computed) points that are guaranteed to be within each geometry.
resample(self, rule[, axis, loffset, on, level])
resample
Resample time-series data.
reset_index(self[, level, drop, name, inplace])
reset_index
Generate a new DataFrame or Series with the index reset.
rfloordiv(self, other[, level, fill_value, axis])
rfloordiv
Return Integer division of series and other, element-wise (binary operator rfloordiv).
rmod(self, other[, level, fill_value, axis])
rmod
Return Modulo of series and other, element-wise (binary operator rmod).
rmul(self, other[, level, fill_value, axis])
rmul
Return Multiplication of series and other, element-wise (binary operator rmul).
rolling(self, window[, min_periods, center, …])
rolling
Provide rolling window calculations.
rotate(self, angle[, origin, use_radians])
rotate
Returns a GeoSeries with rotated geometries.
round(self[, decimals])
round
Round each value in a Series to the given number of decimals.
rpow(self, other[, level, fill_value, axis])
rpow
Return Exponential power of series and other, element-wise (binary operator rpow).
rsub(self, other[, level, fill_value, axis])
rsub
Return Subtraction of series and other, element-wise (binary operator rsub).
rtruediv(self, other[, level, fill_value, axis])
rtruediv
sample(self[, n, frac, replace, weights, …])
sample
Return a random sample of items from an axis of object.
scale(self[, xfact, yfact, zfact, origin])
scale
Returns a GeoSeries with scaled geometries.
searchsorted(self, value[, side, sorter])
searchsorted
Find indices where elements should be inserted to maintain order.
select(self, \*args, \*\*kwargs)
select
sem(self[, axis, skipna, level, ddof, …])
sem
Return unbiased standard error of the mean over requested axis.
set_axis(self, labels[, axis, inplace])
set_axis
Assign desired index to given axis.
set_crs(self[, crs, epsg, inplace, …])
set_crs
Set the Coordinate Reference System (CRS) of a GeoSeries.
shift(self[, periods, freq, axis, fill_value])
shift
Shift index by desired number of periods with an optional time freq.
simplify(self, \*args, \*\*kwargs)
simplify
Returns a GeoSeries containing a simplified representation of each geometry.
skew(self[, xs, ys, origin, use_radians])
skew
Returns a GeoSeries with skewed geometries.
slice_shift(self, periods[, axis])
slice_shift
Equivalent to shift without copying data.
sort_index(self, \*args, \*\*kwargs)
sort_index
Sort Series by index labels.
sort_values(self[, axis, ascending, …])
sort_values
Sort by the values.
squeeze(self[, axis])
squeeze
Squeeze 1 dimensional axis objects into scalars.
std(self[, axis, skipna, level, ddof, …])
std
Return sample standard deviation over requested axis.
sub(self, other[, level, fill_value, axis])
sub
Return Subtraction of series and other, element-wise (binary operator sub).
subtract(self, other[, level, fill_value, axis])
subtract
sum(self[, axis, skipna, level, …])
sum
Return the sum of the values for the requested axis.
swapaxes(self, axis1, axis2[, copy])
swapaxes
Interchange axes and swap values axes appropriately.
swaplevel(self[, i, j, copy])
swaplevel
Swap levels i and j in a MultiIndex.
MultiIndex
symmetric_difference(self, other)
symmetric_difference
Returns a GeoSeries of the symmetric difference of points in each geometry with other.
tail(self, n)
tail
Return the last n rows.
take(self, \*args, \*\*kwargs)
take
Return the elements in the given positional indices along an axis.
to_clipboard(self, excel, sep, …)
to_clipboard
Copy object to the system clipboard.
to_crs(self[, crs, epsg])
to_crs
Returns a GeoSeries with all geometries transformed to a new coordinate reference system.
to_csv(self, path_or_buf, pathlib.Path, …)
to_csv
Write object to a comma-separated values (csv) file.
to_dict(self[, into])
to_dict
Convert Series to {label -> value} dict or dict-like object.
to_excel(self, excel_writer[, sheet_name, …])
to_excel
Write object to an Excel sheet.
to_file(self, filename[, driver, index])
to_file
Write the GeoSeries to a file.
to_frame(self[, name])
to_frame
Convert Series to DataFrame.
to_hdf(self, path_or_buf, key, mode, …[, …])
to_hdf
Write the contained data to an HDF5 file using HDFStore.
to_json(self, \*\*kwargs)
to_json
Returns a GeoJSON string representation of the GeoSeries.
to_latex(self[, buf, columns, col_space, …])
to_latex
Render object to a LaTeX tabular, longtable, or nested table/tabular.
to_list(self)
to_list
Return a list of the values.
to_markdown(self, buf, NoneType] = None, …)
to_markdown
Print Series in Markdown-friendly format.
to_numpy(self[, dtype, copy, na_value])
to_numpy
A NumPy ndarray representing the values in this Series or Index.
to_period(self[, freq, copy])
to_period
Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed).
to_pickle(self, path, compression, …)
to_pickle
Pickle (serialize) object to file.
to_sql(self, name, con[, schema, …])
to_sql
Write records stored in a DataFrame to a SQL database.
to_string(self[, buf, na_rep, float_format, …])
to_string
Render a string representation of the Series.
to_timestamp(self[, freq, how, copy])
to_timestamp
Cast to DatetimeIndex of Timestamps, at beginning of period.
to_xarray(self)
to_xarray
Return an xarray object from the pandas object.
tolist(self)
tolist
touches(self, other)
touches
Returns a Series of dtype('bool') with value True for each geometry that touches other.
transform(self, func[, axis])
transform
Call func on self producing a Series with transformed values.
func
translate(self[, xoff, yoff, zoff])
translate
Returns a GeoSeries with translated geometries.
transpose(self, \*args, \*\*kwargs)
transpose
Return the transpose, which is by definition self.
truediv(self, other[, level, fill_value, axis])
truediv
truncate(self[, before, after, axis])
truncate
Truncate a Series or DataFrame before and after some index value.
tshift(self, periods[, freq, axis])
tshift
Shift the time index, using the index’s frequency if available.
tz_convert(self, tz[, axis, level])
tz_convert
Convert tz-aware axis to target time zone.
tz_localize(self, tz[, axis, level, ambiguous])
tz_localize
Localize tz-naive index of a Series or DataFrame to target time zone.
union(self, other)
union
Returns a GeoSeries of the union of points in each geometry with other.
unique(self)
unique
Return unique values of Series object.
unstack(self[, level, fill_value])
unstack
Unstack, a.k.a.
update(self, other)
update
Modify Series in place using non-NA values from passed Series.
value_counts(self[, normalize, sort, …])
value_counts
Return a Series containing counts of unique values.
var(self[, axis, skipna, level, ddof, …])
var
Return unbiased variance over requested axis.
view(self[, dtype])
view
Create a new view of the Series.
where(self, cond[, other, inplace, axis, …])
where
Replace values where the condition is False.
within(self, other)
within
Returns a Series of dtype('bool') with value True for each geometry that is within other.
xs(self, key[, axis, level])
xs
Return cross-section from the Series/DataFrame.
Attributes
T
area
Returns a Series containing the area of each geometry in the GeoSeries.
array
The ExtensionArray of the data backing this Series or Index.
at
Access a single value for a row/column label pair.
attrs
Dictionary of global attributes on this object.
axes
Return a list of the row axis labels.
boundary
Returns a GeoSeries of lower dimensional objects representing each geometries’s set-theoretic boundary.
bounds
Returns a DataFrame with columns minx, miny, maxx, maxy values containing the bounds for each geometry.
DataFrame
minx
miny
maxx
maxy
cascaded_union
Deprecated: Return the unary_union of all geometries
centroid
Returns a GeoSeries of points representing the centroid of each geometry.
convex_hull
Returns a GeoSeries of geometries representing the convex hull of each geometry.
crs
The Coordinate Reference System (CRS) represented as a pyproj.CRS object.
pyproj.CRS
cx
Coordinate based indexer to select by intersection with bounding box.
Return the dtype object of the underlying data.
dtypes
empty
envelope
Returns a GeoSeries of geometries representing the envelope of each geometry.
exterior
Returns a GeoSeries of LinearRings representing the outer boundary of each polygon in the GeoSeries.
geom_type
Returns a Series of strings specifying the Geometry Type of each object.
geometry
has_z
Returns a Series of dtype('bool') with value True for features that have a z-component.
hasnans
Return if I have any nans; enables various perf speedups.
iat
Access a single value for a row/column pair by integer position.
iloc
Purely integer-location based indexing for selection by position.
index
The index (axis labels) of the Series.
interiors
Returns a Series of List representing the inner rings of each polygon in the GeoSeries.
is_empty
Returns a Series of dtype('bool') with value True for empty geometries.
is_monotonic
Return boolean if values in the object are monotonic_increasing.
is_monotonic_decreasing
Return boolean if values in the object are monotonic_decreasing.
is_monotonic_increasing
is_ring
Returns a Series of dtype('bool') with value True for features that are closed.
is_simple
Returns a Series of dtype('bool') with value True for geometries that do not cross themselves.
is_unique
Return boolean if values in the object are unique.
is_valid
Returns a Series of dtype('bool') with value True for geometries that are valid.
length
Returns a Series containing the length of each geometry.
loc
Access a group of rows and columns by label(s) or a boolean array.
nbytes
Return the number of bytes in the underlying data.
ndim
Number of dimensions of the underlying data, by definition 1.
shape
Return a tuple of the shape of the underlying data.
sindex
size
Return the number of elements in the underlying data.
total_bounds
Returns a tuple containing minx, miny, maxx, maxy values for the bounds of the series as a whole.
type
Return the geometry type of each geometry in the GeoSeries
unary_union
Returns a geometry containing the union of all geometries in the GeoSeries.
values
Return Series as ndarray or ndarray-like depending on the dtype.
x
Return the x location of point geometries in a GeoSeries
y
Return the y location of point geometries in a GeoSeries