geopandas.GeoSeries#
- class geopandas.GeoSeries(data=None, index=None, crs=None, **kwargs)#
一个Series对象,用于存储形状良好的几何体对象。
- 参数
- data类数组、DICT、标量值
要存储在GeoSeries中的几何图形。
- index类似数组或索引
GeoSeries的索引。
- crs值(可选)
几何对象的坐标系。可以是任何可以接受的
pyproj.CRS.from_user_input()例如,授权字符串(例如“EPSG:4326”)或WKT字符串。- kwargs
- 传递给Series构造函数的其他参数,
例如:
name。
示例
>>> from shapely.geometry import Point >>> s = geopandas.GeoSeries([Point(1, 1), Point(2, 2), Point(3, 3)]) >>> s 0 POINT (1.00000 1.00000) 1 POINT (2.00000 2.00000) 2 POINT (3.00000 3.00000) dtype: geometry
>>> s = geopandas.GeoSeries( ... [Point(1, 1), Point(2, 2), Point(3, 3)], crs="EPSG:3857" ... ) >>> s.crs <Projected CRS: EPSG:3857> Name: WGS 84 / Pseudo-Mercator Axis Info [cartesian]: - X[east]: Easting (metre) - Y[north]: Northing (metre) Area of Use: - name: World - 85°S to 85°N - bounds: (-180.0, -85.06, 180.0, 85.06) Coordinate Operation: - name: Popular Visualisation Pseudo-Mercator - method: Popular Visualisation Pseudo Mercator Datum: World Geodetic System 1984 - Ellipsoid: WGS 84 - Prime Meridian: Greenwich
>>> s = geopandas.GeoSeries( ... [Point(1, 1), Point(2, 2), Point(3, 3)], index=["a", "b", "c"], crs=4326 ... ) >>> s a POINT (1.00000 1.00000) b POINT (2.00000 2.00000) c POINT (3.00000 3.00000) dtype: geometry
>>> s.crs <Geographic 2D CRS: EPSG:4326> Name: WGS 84 Axis Info [ellipsoidal]: - Lat[north]: Geodetic latitude (degree) - Lon[east]: Geodetic longitude (degree) Area of Use: - name: World. - bounds: (-180.0, -90.0, 180.0, 90.0) Datum: World Geodetic System 1984 ensemble - Ellipsoid: WGS 84 - Prime Meridian: Greenwich
- __init__(data=None, index=None, crs=None, **kwargs)#
方法:
__init__\([data, index, crs] )abs\()返回一个具有每个元素的绝对数值的Series/DataFrame。
add\(其他[, level, fill_value, axis] )按元素(二元运算符)返回级数和其他的相加 add )。
add_prefix\(前缀)使用字符串为标签添加前缀 prefix 。
add_suffix\(后缀)使用字符串为标签添加后缀 suffix 。
affine_transform\(矩阵)返回一个
GeoSeries使用平移的几何图形。agg\([func, axis] )使用指定轴上的一个或多个操作进行聚合。
aggregate\([func, axis] )使用指定轴上的一个或多个操作进行聚合。
align\(其他[, join, axis, level, copy, ...] )将两个对象的轴向与指定的联接方法对齐。
all\([axis, bool_only, skipna, level] )返回是否所有元素都为True,可能是在某个轴上。
any\([axis, bool_only, skipna, level] )返回是否有任何元素为True,可能是在轴上。
append\(*args, * *kwargs)串联两个或多个系列。
apply\(函数[, convert_dtype, args] )带有轴标签的一维ndarray(包括时间序列)。
argmax\([axis, skipna] )返回序列中最大值的整型位置。
argmin\([axis, skipna] )返回序列中最小值的int位置。
argsort\([axis, kind, order] )返回对Series值进行排序的整数索引。
asfreq\(频率 [, method, how, normalize, ...] )将时间序列转换为指定频率。
asof\(其中 [, subset] )返回之前没有任何NAN的最后一行 where 。
astype\(dtype[, copy, errors] )将熊猫对象强制转换为指定的dtype
dtype。at_time\(时间[, asof, axis] )选择一天中特定时间(例如上午9:30)的值。
autocorr\([lag] )计算LAG-N自相关。
backfill\([axis, inplace, limit, downcast] )的同义词
DataFrame.fillna()使用method='bfill'。between\(左、右[, inclusive] )返回等同于Left<=Series<=Right的布尔级数。
between_time\(开始_时间,结束_时间 [, ...] )选择一天中特定时间(例如,上午9:00-9:30)之间的值。
bfill\([axis, inplace, limit, downcast] )的同义词
DataFrame.fillna()使用method='bfill'。bool\()返回单个元素Series或DataFrame的布尔值。
buffer\(距离[, resolution] )返回一个
GeoSeries表示给定区域内所有点的几何图形distance每个几何对象的。clip\(掩码[, keep_geom_type] )将点、线或多边形几何体剪裁到遮罩范围。
clip_by_rect\(xmin,ymin,xmax,ymax)返回一个
GeoSeries给定矩形内的几何图形部分的。combine\(其他、函数 [, fill_value] )根据将系列与系列或标量组合在一起 func 。
combine_first\(其他)使用‘Other’中相同位置的值更新空元素。
compare\(其他[, align_axis, keep_shape, ...] )与其他系列进行比较,并显示不同之处。
contains\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于包含以下内容的每个对齐几何图形 other 。convert_dtypes\([infer_objects, ...] )使用支持的数据类型将列转换为最佳数据类型
pd.NA。copy\([deep] )复制此对象的索引和数据。
corr\(其他[, method, min_periods] )计算相关性与 other 序列,不包括缺失值。
count\([level] )返回序列中非NA/NULL观测值的数量。
cov\(其他[, min_periods, ddof] )计算系列协方差,不包括缺失值。
covered_by\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于完全覆盖的每个对齐的几何体 other 。covers\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于完全覆盖的每个对齐几何体 other 。crosses\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于交叉的每个对齐几何图形 other 。cummax\([axis, skipna] )返回DataFrame或Series轴上的累计最大值。
cummin\([axis, skipna] )返回DataFrame或Series轴上的累计最小值。
cumprod\([axis, skipna] )返回DataFrame或Series轴上的累计积。
cumsum\([axis, skipna] )返回DataFrame或Series轴上的累计和。
describe\([percentiles, include, exclude, ...] )生成描述性统计数据。
diff\([periods] )单元的一阶离散差分。
difference\(其他[, align] )返回一个
GeoSeries每个对齐几何图形中不在中的点的 other 。disjoint\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于每个与不相交的对齐几何图形 other 。distance\(其他[, align] )返回一个
Series包含要对齐的距离 other 。div\(其他[, level, fill_value, axis] )返回按元素(二元运算符)的级数和其他的浮点除法 truediv )。
divide\(其他[, level, fill_value, axis] )返回按元素(二元运算符)的级数和其他的浮点除法 truediv )。
divmod\(其他[, level, fill_value, axis] )返回级数和其他元素的整数除法和模运算(二元运算符 divmod )。
dot\(其他)计算级数和其他列之间的点积。
drop\([labels, axis, index, columns, level, ...] )删除了指定索引标签的返回系列。
drop_duplicates\([keep, inplace] )已删除重复值的返回系列。
droplevel\(级别[, axis] )返回删除了请求的索引/列级别的Series/DataFrame。
dropna\([axis, inplace, how] )返回删除了缺失值的新系列。
duplicated\([keep] )表示重复的系列值。
eq\(其他[, level, fill_value, axis] )按元素(二元运算符)返回级数和其他的等于 eq )。
equals\(其他)测试两个对象是否包含相同的元素。
estimate_utm_crs\([datum_name] )根据数据集的边界返回估计的UTM CRS。
ewm\([com, span, halflife, alpha, ...] )提供指数加权(EW)函数。
expanding\([min_periods, center, axis, method] )提供扩展转型。
explode\([ignore_index, index_parts] )将多零件几何图形分解为多个单一几何图形。
基于Folium/leaflet.js的交互地图基于GeoPandas和Folium/leaflet.js的交互地图
factorize\([sort, na_sentinel] )将对象编码为枚举类型或类别变量。
ffill\([axis, inplace, limit, downcast] )的同义词
DataFrame.fillna()使用method='ffill'。fillna\([value, method, inplace] )使用几何体填充NA值(默认情况下为空多边形)。
filter\([items, like, regex, axis] )根据指定的索引标签子集数据帧的行或列。
first\(偏移)根据日期偏移量选择时间序列数据的初始期间。
first_valid_index\()返回第一个非NA值的索引,如果未找到NA值,则返回NONE。
floordiv\(其他[, level, fill_value, axis] )返回级数和其他元素的整数除法(二元运算符 floordiv )。
替代构造函数以创建
GeoSeries从一个文件中。from_wkb\(数据[, index, crs] )替代构造函数以创建
GeoSeries从WKB对象的列表或数组from_wkt\(数据[, index, crs] )替代构造函数以创建
GeoSeries从WKT对象的列表或数组from_xy\(X,y[, z, index, crs] )替代构造函数以创建
GeoSeriesX,y(,z)坐标列表或数组中的点几何图形ge\(其他[, level, fill_value, axis] )按元素(二元运算符)返回大于或等于级数和其他 ge )。
geom_almost_equals\(其他[, decimal, align] )返回一个
Series的dtype('bool')有价值的True如果每个对齐的几何图形近似等于 other 。geom_equals\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于等于的每个对齐几何图形 other 。geom_equals_exact\(其他、容差[, align] )对于相等对齐的所有几何图形,返回True 其他 到给定的容忍度,否则为假。
get\(密钥[, default] )从给定键的对象中获取项(例如:DataFrame列)。
groupby\([by, axis, level, as_index, sort, ...] )使用映射器或按一系列柱对系列进行分组。
gt\(其他[, level, fill_value, axis] )按元素(二元运算符)返回系列和其他的大于 gt )。
head\([n] )返回第一个 n 排好了。
hist\([by, ax, grid, xlabelsize, xrot, ...] )使用matplotlib绘制输入序列的直方图。
idxmax\([axis, skipna] )返回最大值的行标签。
idxmin\([axis, skipna] )返回最小值的行标签。
infer_objects\()尝试为对象列推断更好的数据类型。
interpolate\(距离[, normalized] )沿每个几何图形在指定距离处返回一个点
intersection\(其他[, align] )返回一个
GeoSeries每个对齐的几何图形中的点的交点的 other 。intersects\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于每个相交的对齐几何图形 other 。isin\(值)系列中的元素是否包含在 values 。
isna\()检测缺少的值。
isnull\()的别名 isna 方法。
item\()将底层数据的第一个元素作为Python标量返回。
items\()懒惰地迭代(索引、值)元组。
iteritems\()懒惰地迭代(索引、值)元组。
keys\()返回索引的别名。
kurt\([axis, skipna, level, numeric_only] )返回请求的轴上的无偏峰度。
kurtosis\([axis, skipna, level, numeric_only] )返回请求的轴上的无偏峰度。
last\(偏移)根据日期偏移量选择时间序列数据的最终期间。
last_valid_index\()返回最后一个非NA值的索引,如果未找到NA值,则返回NONE。
le\(其他[, level, fill_value, axis] )按元素(二元运算符)返回小于或等于的级数和其他 le )。
lt\(其他[, level, fill_value, axis] )按元素(二元运算符)返回小于级数和其他 lt )。
mad\([axis, skipna, level] )返回值在请求的轴上的平均绝对偏差。
map\(参数[, na_action] )根据输入对应关系映射系列的值。
mask\(条件[, other, inplace, axis, level, ...] )替换条件为True的值。
max\([axis, skipna, level, numeric_only] )返回请求的轴上的最大值。
mean\([axis, skipna, level, numeric_only] )返回请求的轴上的值的平均值。
median\([axis, skipna, level, numeric_only] )返回值在请求的轴上的中位数。
memory_usage\([index, deep] )返回该系列的内存使用情况。
min\([axis, skipna, level, numeric_only] )返回请求的轴上的最小值。
mod\(其他[, level, fill_value, axis] )级数和其他元素的返回模数(二元运算符 mod )。
mode\([dropna] )返回系列的模式。
mul\(其他[, level, fill_value, axis] )级数和其他元素的返回乘法(二元运算符 mul )。
multiply\(其他[, level, fill_value, axis] )级数和其他元素的返回乘法(二元运算符 mul )。
ne\(其他[, level, fill_value, axis] )按元素(二元运算符)返回不等于的级数和其他 ne )。
nlargest\([n, keep] )退回最大的 n 元素。
notna\()检测非缺失值。
notnull\()的别名 notna 方法。
nsmallest\([n, keep] )返回最小的 n 元素。
nunique\([dropna] )返回对象中唯一元素的数量。
overlaps\(其他[, align] )对所有重叠的对齐几何返回True 其他 ,否则为False。
pad\([axis, inplace, limit, downcast] )的同义词
DataFrame.fillna()使用method='ffill'。pct_change\([periods, fill_method, limit, freq] )当前元素和前一个元素之间的百分比变化。
pipe\(函数,*args, * *kwargs)应用函数(自身,*args, * *kwargs)。
绘制GeoSeries。
pop\(项目)从系列中退货和退货。
pow\(其他[, level, fill_value, axis] )返回级数和其他元素的指数幂(二元运算符 pow )。
prod\([axis, skipna, level, numeric_only, ...] )返回值在请求的轴上的乘积。
product\([axis, skipna, level, numeric_only, ...] )返回值在请求的轴上的乘积。
project\(其他[, normalized, align] )返回距离最接近的每个几何图形的距离 其他
quantile\([q, interpolation] )返回给定分位数的值。
radd\(其他[, level, fill_value, axis] )按元素(二元运算符)返回级数和其他的相加 radd )。
rank\([axis, method, numeric_only, ...] )沿轴计算数值数据排名(从1到n)。
ravel\([order] )将拼合的基础数据作为ndarray返回。
rdiv\(其他[, level, fill_value, axis] )返回按元素(二元运算符)的级数和其他的浮点除法 rtruediv )。
rdivmod\(其他[, level, fill_value, axis] )返回级数和其他元素的整数除法和模运算(二元运算符 rdivmod )。
reindex\([index] )通过可选的填充逻辑使系列符合新的索引。
reindex_like\(其他[, method, copy, limit, ...] )将索引匹配的对象作为其他对象返回。
relate\(其他[, align] )返回几何的DE-9IM交矩阵
rename\([index, axis, copy, inplace, level, ...] )更改系列索引标签或名称。
rename_axis\([mapper, index, columns, axis, ...] )设置索引或列的轴的名称。
reorder_levels\(订单)使用输入顺序重新排列索引级别。
repeat\(重复[, axis] )重复系列的元素。
replace\([to_replace, value, inplace, limit, ...] )替换中给出的值 to_replace 使用 value 。
返回一个
GeoSeries指保证位于每个几何图形内的(计算成本较低的)点。resample\(规则[, axis, closed, label, ...] )重新采样时间序列数据。
reset_index\([level, drop, name, inplace] )在重置索引的情况下生成新的DataFrame或Series。
rfloordiv\(其他[, level, fill_value, axis] )返回级数和其他元素的整数除法(二元运算符 rfloordiv )。
rmod\(其他[, level, fill_value, axis] )级数和其他元素的返回模数(二元运算符 rmod )。
rmul\(其他[, level, fill_value, axis] )级数和其他元素的返回乘法(二元运算符 rmul )。
rolling\(窗口[, min_periods, center, ...] )提供滚动窗口计算。
rotate\(角度 [, origin, use_radians] )返回一个
GeoSeries具有旋转的几何图形。round\([decimals] )将序列中的每个值四舍五入到给定的小数位数。
rpow\(其他[, level, fill_value, axis] )返回级数和其他元素的指数幂(二元运算符 rpow )。
rsub\(其他[, level, fill_value, axis] )级数和其他元素的返回减法(二元运算符 rsub )。
rtruediv\(其他[, level, fill_value, axis] )返回按元素(二元运算符)的级数和其他的浮点除法 rtruediv )。
sample\([n, frac, replace, weights, ...] )从对象轴返回项目的随机样本。
scale\([xfact, yfact, zfact, origin] )返回一个
GeoSeries具有缩放的几何图形。searchsorted\(值[, side, sorter] )查找应插入元素以维持顺序的索引。
select\(*args, * *kwargs)带有轴标签的一维ndarray(包括时间序列)。
sem\([axis, skipna, level, ddof, numeric_only] )返回请求轴上平均值的无偏标准误差。
set_axis\(标签[, axis, inplace] )将所需的索引指定给给定轴。
set_crs\([crs, epsg, inplace, allow_override] )设置的坐标系(CRS)
GeoSeries。set_flags\(*[, copy, allows_duplicate_labels] )返回一个具有更新标志的新对象。
shift\([periods, freq, axis, fill_value] )使用可选时间按所需期间数移位索引 freq 。
返回一个
GeoSeries包含每个几何图形的简化表示。skew\([xs, ys, origin, use_radians] )返回一个
GeoSeries具有扭曲的几何形状。slice_shift\([periods, axis] )相当于 shift 而不复制数据。
sort_index\(*args, * *kwargs)带有轴标签的一维ndarray(包括时间序列)。
sort_values\([axis, ascending, inplace, ...] )按值排序。
squeeze\([axis] )将1维轴对象压缩为标量。
std\([axis, skipna, level, ddof, numeric_only] )返回要求轴上的样本标准偏差。
sub\(其他[, level, fill_value, axis] )级数和其他元素的返回减法(二元运算符 sub )。
subtract\(其他[, level, fill_value, axis] )级数和其他元素的返回减法(二元运算符 sub )。
sum\([axis, skipna, level, numeric_only, ...] )返回请求的轴上的值的总和。
swapaxes\(axis1、axis2[, copy] )适当地互换轴和交换值轴。
swaplevel\([i, j, copy] )中交换级别i和j。
MultiIndex。symmetric_difference\(其他[, align] )返回一个
GeoSeries每个对齐的几何图形中的点的对称差的 other 。tail\([n] )退还最后一张 n 排好了。
take\(*args, * *kwargs)带有轴标签的一维ndarray(包括时间序列)。
to_clipboard\([excel, sep] )将对象复制到系统剪贴板。
to_crs\([crs, epsg] )返回一个
GeoSeries将所有几何图形转换到新的坐标参考系。to_csv\([path_or_buf, sep, na_rep, ...] )将对象写入逗号分隔值(CSV)文件。
to_dict\([into] )将系列转换为{标签->值}词典或类似词典的对象。
to_excel\(EXCEL_编写器[, sheet_name, na_rep, ...] )将对象写入Excel工作表。
to_file\(文件名[, driver, index] )写下
GeoSeries保存到文件中。to_frame\([name] )将系列转换为DataFrame。
to_hdf\(路径_或_buf,键[, mode, complevel, ...] )使用HDFStore将包含的数据写入HDF5文件。
返回GeoSeries的GeoJSON字符串表示形式。
to_latex\([buf, columns, col_space, header, ...] )将对象渲染到LaTeX表格、长表格或嵌套表格/表格。
to_list\()返回值列表。
to_markdown\([buf, mode, index, storage_options] )以支持降价的格式打印系列。
to_numpy\([dtype, copy, na_value] )表示此系列或索引中的值的NumPy ndarray。
to_period\([freq, copy] )将系列从DatetimeIndex转换为PerodIndex。
to_pickle\(路径[, compression, protocol, ...] )Pickle(序列化)对象到文件。
to_sql\(名称,控制 [, schema, if_exists, ...] )将存储在DataFrame中的记录写入SQL数据库。
to_string\([buf, na_rep, float_format, ...] )呈现序列的字符串表示形式。
to_timestamp\([freq, how, copy] )强制转换为时间戳的DatetimeIndex,位于 起头 属于那个时期。
to_wkb\([hex] )将GeoSeries几何转换为WKB
将GeoSeries几何转换为WKT
to_xarray\()从Pandas对象返回一个XARRAY对象。
tolist\()返回值列表。
touches\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于接触到的每个对齐几何体 other 。transform\(函数[, axis] )打电话
func论自我创造价值转化的系列剧。translate\([xoff, yoff, zoff] )返回一个
GeoSeries使用平移的几何图形。transpose\(*args, * *kwargs)返回转置,根据定义,转置是self。
truediv\(其他[, level, fill_value, axis] )返回按元素(二元运算符)的级数和其他的浮点除法 truediv )。
truncate\([before, after, axis, copy] )在某些索引值之前和之后截断Series或DataFrame。
tshift\([periods, freq, axis] )移动时间索引,使用索引的频率(如果可用)。
tz_convert\(TZ[, axis, level, copy] )将TZ感知轴转换为目标时区。
tz_localize\(TZ[, axis, level, copy, ...] )将Series或DataFrame的Tz-naive索引本地化到目标时区。
union\(其他[, align] )返回一个
GeoSeries每个对齐的几何图形中的点的并集 other 。unique\()返回Series对象的唯一值。
unstack\([level, fill_value] )取消堆叠,也称为Pivot,与多索引串联以生成DataFrame。
update\(其他)使用传递的系列中的值就地修改系列。
value_counts\([normalize, sort, ascending, ...] )返回包含唯一值计数的系列。
var\([axis, skipna, level, ddof, numeric_only] )返回请求的轴上的无偏差。
view\([dtype] )创建系列的新视图。
where\(条件[, other, inplace, axis, level, ...] )替换条件为FALSE的值。
within\(其他[, align] )返回一个
Series的dtype('bool')有价值的True对于中的每个对齐几何图形 other 。xs\(密钥[, axis, level, drop_level] )从系列/数据帧返回横截面。
属性
T返回转置,根据定义,转置是self。
返回一个
Series中每个几何图形的面积。GeoSeries以CRS为单位表示。array支持此系列或索引的数据的扩展数组。
at访问行/列标签对的单个值。
attrs此数据集的全局属性的字典。
axes返回行轴标签列表。
返回一个
GeoSeries表示每个几何的集合论的低维对象 boundary 。返回一个
DataFrame带柱的minx,miny,maxx,maxy值,这些值包含每个几何图形的边界。cascaded_union已弃用:使用 unary_union 取而代之的是
返回一个
GeoSeries表示每个几何体的质心的点。返回一个
GeoSeries表示每个几何图形的凸包的几何图形。坐标参考系(CRS)表示为
pyproj.CRS对象。基于坐标的索引器,通过与边界框的交点进行选择。
dtype返回底层数据的dtype对象。
dtypes返回底层数据的dtype对象。
empty指示DataFrame是否为空。
返回一个
GeoSeries表示每个几何图形的包络的几何图形。返回一个
GeoSeries表示GeoSeries中每个多边形的外边界的线环。flags获取与此熊猫对象关联的属性。
返回一个
Series字符串的值,指定 Geometry Type 每一件物品的。geometry检查空间索引是否存在,而不生成它。
返回一个
Series的dtype('bool')有价值的True用于具有z分量的要素。hasnans如果我有任何nan,请返回;启用各种性能加速。
iat按整数位置访问行/列对的单个值。
iloc纯粹基于整数位置的索引,用于按位置选择。
index系列的索引(轴标签)。
返回一个
Series表示GeoSeries中每个多边形的内环的列表。返回一个
Series的dtype('bool')有价值的True用于空几何图形。is_monotonic如果对象中的值是单调递增的,则返回布尔值。
is_monotonic_decreasing如果对象中的值是单调递减的,则返回布尔值。
is_monotonic_increasing的别名是单调的。
返回一个
Series的dtype('bool')有价值的True对于闭合的要素。返回一个
Series的dtype('bool')有价值的True对于本身不相交的几何图形。is_unique如果对象中的值是唯一的,则返回布尔值。
返回一个
Series的dtype('bool')有价值的True对于有效的几何图形。返回一个
Series包含以CRS为单位表示的每个几何图形的长度。loc通过标签或布尔数组访问一组行和列。
name返回系列的名称。
nbytes返回基础数据中的字节数。
ndim根据定义1,基础数据的维度数。
shape返回基础数据的形状的元组。
生成空间索引
size返回基础数据中的元素数。
返回包含以下内容的元组
minx,miny,maxx,maxy作为整体的序列边界的值。type返回GeoSeries中每个几何的几何类型
中所有几何图形的并集的几何图形。
GeoSeries。values根据数据类型将系列返回为ndarray或类似ndarray。
返回点几何在GeoSeries中的x位置
返回点几何在GeoSeries中的y位置
返回点几何在GeoSeries中的z位置