Series#

构造函数#

cudf.Series([data, index, dtype, name, copy, ...])

一维 GPU 数组(包括时间序列)。

属性#

Series.axes

返回表示 Series 轴的列表。

Series.index

获取行的标签。

Series.values

返回 DataFrame 的 CuPy 表示形式。

Series.data

数据对应的 GPU 缓冲区

Series.dtype

Series 的 dtype。

Series.dtypes

Series 的 dtype。

Series.shape

获取表示 Index 维度的元组。

Series.ndim

底层数据的维度数,定义上为 1。

Series.nullable

指示是否需要空值掩码的布尔值

Series.nullmask

空值掩码对应的 GPU 缓冲区

Series.null_count

空值数量

Series.size

返回底层数据中的元素数量。

Series.T

返回转置,根据定义即为自身。

Series.memory_usage([index, deep])

返回对象的内存使用情况。

Series.hasnans

如果存在任何 NaNs 或空值,则返回 True。

Series.has_nulls

指示 Series 是否包含空值。

Series.empty

指示 DataFrame 或 Series 是否为空。

Series.name

获取此对象的名称。

Series.valid_count

非空值数量

Series.values_host

返回数据的 NumPy 表示形式。

转换#

Series.astype(dtype[, copy, errors])

将对象转换为给定的 dtype。

Series.convert_dtypes([infer_objects, ...])

将列转换为最佳的可空 dtype。

Series.copy([deep])

创建此对象的索引和数据的副本。

Series.deserialize(header, frames)

从序列化表示生成对象。

Series.device_deserialize(header, frames)

执行设备端反序列化任务。

Series.device_serialize()

序列化与设备内存相关的数据和元数据。

Series.host_deserialize(header, frames)

执行设备端反序列化任务。

Series.host_serialize()

序列化与主机内存相关的数据和元数据。

Series.serialize()

生成对象的等效可序列化表示形式。

Series.to_list()

当前不支持转换为主机内存列表

Series.tolist()

当前不支持转换为主机内存列表

Series.__array__([dtype, copy])

Series.scale()

将值按 float64 缩放到 [0, 1]

索引、迭代#

Series.loc

按标签或布尔掩码选择行和列。

Series.iloc

按位置选择值。

Series.__iter__()

不支持迭代。

Series.items()

不支持迭代。

Series.iteritems()

不支持迭代。

Series.keys()

返回 index 的别名。

Series.squeeze([axis])

将一维轴对象压缩为标量。

二元运算符函数#

Series.add(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素相加(二元运算符 add)。

Series.sub(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素相减(二元运算符 sub)。

Series.subtract(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素相减(二元运算符 sub)。

Series.mul(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素相乘(二元运算符 mul)。

Series.multiply(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素相乘(二元运算符 mul)。

Series.truediv(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素浮点除法(二元运算符 truediv)。

Series.div(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素浮点除法(二元运算符 truediv)。

Series.divide(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素浮点除法(二元运算符 truediv)。

Series.floordiv(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素整数除法(二元运算符 floordiv)。

Series.mod(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素取模(二元运算符 mod)。

Series.pow(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素指数(二元运算符 pow)。

Series.radd(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向相加(二元运算符 radd)。

Series.rsub(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向相减(二元运算符 rsub)。

Series.rmul(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向相乘(二元运算符 rmul)。

Series.rdiv(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向浮点除法(二元运算符 rtruediv)。

Series.rtruediv(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向浮点除法(二元运算符 rtruediv)。

Series.rfloordiv(other[, level, fill_value, ...])

获取 DataFrame 或 Series 与 other 的逐元素反向整数除法(二元运算符 rfloordiv)。

Series.rmod(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向取模(二元运算符 rmod)。

Series.rpow(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素反向指数(二元运算符 rpow)。

Series.round([decimals, how])

四舍五入到可变的小数位数。

Series.lt(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素小于比较(二元运算符 lt)。

Series.gt(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素大于比较(二元运算符 gt)。

Series.le(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素小于等于比较(二元运算符 le)。

Series.ge(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素大于等于比较(二元运算符 ge)。

Series.ne(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素不等于比较(二元运算符 ne)。

Series.eq(other[, level, fill_value, axis])

获取 DataFrame 或 Series 与 other 的逐元素等于比较(二元运算符 eq)。

Series.product([axis, skipna, numeric_only, ...])

返回 DataFrame 中值的乘积。

Series.dot(other[, reflect])

获取 frame 与 other 的点积(二元运算符 dot)。

函数应用、GroupBy 和 window#

Series.apply(func[, convert_dtype, args, by_row])

对 Series 的值应用标量函数。

Series.map(arg[, na_action])

根据输入的对应关系映射 Series 的值。

Series.groupby([by, axis, level, as_index, ...])

使用映射器或按列的 Series 进行分组。

Series.rolling(window[, min_periods, ...])

滑动窗口计算。

Series.pipe(func, *args, **kwargs)

应用 func(self, *args, **kwargs)

计算 / 描述性统计#

Series.abs()

返回一个 Series/DataFrame,其中包含每个元素的绝对数值。

Series.all([axis, bool_only, skipna])

返回 DataFrame 中所有元素是否都为 True。

Series.any([axis, bool_only, skipna])

返回 DataFrame 中是否有任何元素为 True。

Series.autocorr([lag])

计算滞后 N 的自相关。

Series.between(left, right[, inclusive])

返回等同于 left <= series <= right 的布尔 Series。

Series.clip([lower, upper, axis, inplace])

根据输入阈值裁剪值。

Series.corr(other[, method, min_periods])

计算两个 Series 之间的样本相关性,不包括缺失值。

Series.count()

返回 Series 中非 NA/null 观测值的数量

Series.cov(other[, min_periods, ddof])

计算与 Series 的协方差,不包括缺失值。

Series.cummax([axis, skipna])

返回 Series 的累积最大值。

Series.cummin([axis, skipna])

返回 Series 的累积最小值。

Series.cumprod([axis, skipna])

返回 Series 的累积乘积。

Series.cumsum([axis, skipna])

返回 Series 的累积和。

Series.describe([percentiles, include, exclude])

生成描述性统计信息。

Series.diff([periods])

元素的首次离散差。

Series.digitize(bins[, right])

返回每个值所属 bin 的索引。

Series.ewm([com, span, halflife, alpha, ...])

提供指数加权 (EW) 函数。

Series.factorize([sort, use_na_sentinel])

将输入值编码为整数标签。

Series.kurt([axis, skipna, numeric_only])

返回样本的 Fisher 无偏峰度。

Series.max([axis, skipna, numeric_only])

返回 DataFrame 中值的最大值。

Series.mean([axis, skipna, numeric_only])

返回请求轴的值的平均值。

Series.median([axis, skipna, numeric_only])

返回请求轴的值的中位数。

Series.min([axis, skipna, numeric_only])

返回 DataFrame 中值的最小值。

Series.mode([dropna])

返回数据集的众数。

Series.nlargest([n, keep])

返回一个包含 n 个最大元素的新 Series。

Series.nsmallest([n, keep])

返回一个包含 n 个最小元素的新 Series。

Series.pct_change([periods, fill_method, ...])

计算 Series 中连续元素之间的百分比变化。

Series.prod([axis, skipna, numeric_only, ...])

返回 DataFrame 中值的乘积。

Series.quantile([q, interpolation, exact, ...])

返回给定分位数的值。

Series.rank([axis, method, numeric_only, ...])

沿轴计算数值数据的排名(1 到 n)。

Series.skew([axis, skipna, numeric_only])

返回样本的无偏 Fisher-Pearson 偏度。

Series.std([axis, skipna, ddof, numeric_only])

返回 DataFrame 的样本标准差。

Series.sum([axis, skipna, numeric_only, ...])

返回 DataFrame 中值的总和。

Series.var([axis, skipna, ddof, numeric_only])

返回 DataFrame 的无偏方差。

Series.kurtosis([axis, skipna, numeric_only])

返回样本的 Fisher 无偏峰度。

Series.unique()

返回此 Series 的唯一值。

Series.nunique([dropna])

返回列中唯一值的数量。

Series.is_unique

如果对象中的值是唯一的,则返回布尔值。

Series.is_monotonic_increasing

如果对象中的值是单调递增的,则返回布尔值。

Series.is_monotonic_decreasing

如果对象中的值是单调递减的,则返回布尔值。

Series.value_counts([normalize, sort, ...])

返回包含唯一值计数的 Series。

重索引 / 选择 / 标签操作#

Series.add_prefix(prefix[, axis])

使用字符串 prefix 给标签添加前缀。

Series.add_suffix(suffix[, axis])

使用字符串 suffix 给标签添加后缀。

Series.drop([labels, axis, index, columns, ...])

从行或列中删除指定的标签。

Series.drop_duplicates([keep, inplace, ...])

返回移除重复值后的 Series。

Series.duplicated([keep])

指示重复的 Series 值。

Series.equals(other)

测试两个对象是否包含相同的元素。

Series.first(offset)

根据日期偏移量选择时间序列数据的初始周期。

Series.head([n])

返回前 n 行。

Series.isin(values)

检查值是否包含在 Series 中。

Series.last(offset)

根据日期偏移量选择时间序列数据的最终周期。

Series.reindex([index, axis, method, copy, ...])

使 Series 符合新索引。

Series.rename([index, axis, copy, inplace, ...])

修改 Series 名称

Series.reset_index([level, drop, name, ...])

重置 Series 的索引,或其中一个级别。

Series.sample([n, frac, replace, weights, ...])

从对象的一个轴中返回随机抽样的项。

Series.take(indices[, axis])

返回一个包含由 indices 指定的行的新 Frame。

Series.tail([n])

以新的 DataFrame 或 Series 形式返回最后 n 行。

Series.tile(count)

将行重复 count 次以形成一个新的 Frame。

Series.truncate([before, after, axis, copy])

在某个索引值之前和之后截断 Series 或 DataFrame。

Series.where(cond[, other, inplace, axis, level])

在条件为 False 的地方替换值。

Series.mask(cond[, other, inplace, axis, level])

在条件为 True 的地方替换值。

缺失数据处理#

Series.backfill([value, axis, inplace, limit])

Series.fillna() 的同义词,使用 method='bfill'

Series.bfill([value, axis, inplace, limit, ...])

Series.fillna() 的同义词,使用 method='bfill'

Series.dropna([axis, inplace, how, ignore_index])

返回一个移除 null 值的 Series。

Series.ffill([value, axis, inplace, limit, ...])

Series.fillna() 的同义词,使用 method='ffill'

Series.fillna([value, method, axis, ...])

value 或指定的 method 填充 null 值。

Series.interpolate([method, axis, limit, ...])

在某些点之间插值数据值。

Series.isna()

识别缺失值。

Series.isnull()

识别缺失值。

Series.nans_to_nulls()

将 nan 值(如果存在)转换为 null 值。

Series.notna()

识别非缺失值。

Series.notnull()

识别非缺失值。

Series.pad([value, axis, inplace, limit])

Series.fillna() 的同义词,使用 method='ffill'

Series.replace([to_replace, value, inplace, ...])

value 替换 to_replace 中给定的值。

重塑、排序#

Series.argsort([axis, kind, order, ...])

返回对 Series 值进行排序的整数索引。

Series.sort_values([axis, ascending, ...])

沿任一轴按值排序。

Series.sort_index([axis, level, ascending, ...])

按标签(沿轴)排序对象。

Series.explode([ignore_index])

将类列表的每个元素转换为行,并复制索引值。

Series.searchsorted(values[, side, sorter, ...])

查找应插入元素以保持顺序的索引。

Series.repeat(repeats[, axis])

连续重复元素。

Series.transpose()

返回转置,根据定义即为自身。

组合 / 比较 / 连接 / 合并#

Series.update(other)

使用传入 Series 中的值就地修改 Series。

访问器#

pandas 在各种访问器下提供了特定于 dtype 的方法。这些是 Series 中仅适用于特定数据类型的独立命名空间。

数据类型

访问器

日期时间, 时间差

dt

字符串

str

分类

cat

列表

list

结构体

struct

日期时间类属性#

Series.dt 可用于将 Series 的值作为日期时间类访问,并返回几个属性。可以通过 Series.dt.<function/property> 的方式访问这些属性。

Series.dt

Series 值的日期时间类属性的访问器对象。

日期时间属性#

日期时间的年份。

月份,1 表示一月,12 表示十二月。

日期时间的日期。

日期时间的小时。

日期时间的分钟。

日期时间的秒。

微秒

日期时间的微秒。

纳秒

日期时间的纳秒。

星期几

星期几,0 表示周一,6 表示周日。

weekday

星期几,0 表示周一,6 表示周日。

一年中的第几天

一年中的第几天,非闰年为 1-365,闰年为 1-366。

day_of_year

一年中的第几天,非闰年为 1-365,闰年为 1-366。

季度

指示日期属于一年中哪个季度的整数。

是否是月初

布尔值,指示日期是否是月份的第一天。

是否是月末

布尔值指示日期是否是月份的最后一天。

是否是季度初

布尔值指示日期是否是季度的第一天。

是否是季度末

布尔值指示日期是否是季度的最后一天。

是否是年初

布尔值指示日期是否是一年的第一天。

是否是年末

布尔值指示日期是否是一年的最后一天。

是否是闰年

布尔值指示日期是否属于闰年。

月份天数

获取日期所在月份的总天数。

日期时间方法#

isocalendar()

返回一个 DataFrame,其中包含根据 ISO 8601 标准计算的年、周和日。

strftime(date_format, *args, **kwargs)

使用指定的 date_format 转换为 Series。

round(freq)

对数据执行指定 freq 的 round 操作。

floor(freq)

对数据执行指定 freq 的 floor 操作。

ceil(freq)

对数据执行指定 freq 的 ceil 操作。

tz_localize(tz[, ambiguous, nonexistent])

将时区不敏感的数据本地化为时区敏感的数据。

时间差属性#

天数

天数。

秒数

秒数(>= 0 且小于 1 天)。

微秒数

微秒数(>= 0 且小于 1 秒)。

纳秒数

返回纳秒数 (n),其中 0 <= n < 1 微秒。

组件

返回一个包含 Timedelta 组件的 DataFrame。

字符串处理#

Series.str 可用于将 Series 的值作为字符串访问,并对其应用多种方法。可以通过 Series.str.<function/property> 的方式访问这些方法。

Series.str

Series 和 Index 的向量化字符串函数。

字节计数()

计算 Series/Index 中每个字符串的字节数。

首字母大写()

将 Series/Index 中的字符串转换为首字母大写。

cat()

使用给定的分隔符连接 Series/Index 中的字符串。

center(width[, fillchar])

使用附加字符填充 Series/Index 中字符串的左侧和右侧。

character_ngrams([n, as_list])

从字符串列中的字符生成 n-gram。

字符分词()

每个字符串被分割成单个字符。

码位()

返回一个数组,其中填充了每个字符串中每个字符的 UTF-8 码点值。

contains(pat[, case, flags, na, regex])

测试 Series 或 Index 的字符串中是否包含模式或正则表达式。

count(pat[, flags])

计算 Series/Index 中每个字符串中模式的出现次数。

detokenize(indices[, separator])

通过按照令牌在 indices 列中出现的顺序连接它们,将令牌组合成字符串。

edit_distance(targets)

使用 Levenshtein 编辑距离算法测量 targets 字符串与此实例中字符串的距离。

编辑距离矩阵()

计算 Series 中字符串之间的编辑距离。

endswith(pat)

测试每个字符串元素的结尾是否匹配模式。

extract(pat[, flags, expand])

将正则表达式 pat 中的捕获组提取为 DataFrame 中的列。

filter_alphanum([repl, keep])

从此列中的字符串中移除非字母数字字符。

filter_characters(table[, keep, repl])

使用给定映射表中的字符范围从每个字符串中移除字符。

filter_tokens(min_token_length[, ...])

从 Series 的每个字符串中移除小于 min_token_length 的令牌,并可选择将其替换为替换字符串。

find(sub[, start, end])

返回 Series/Index 中每个字符串中子字符串完全包含在 [start:end] 之间的最低索引。

findall(pat[, flags])

在 Series/Index 中查找模式或正则表达式的所有出现。

find_multiple(patterns)

在 Series/Index 中查找模式的所有首次出现。

get([i])

从指定位置的每个组件中提取元素。

get_json_object(json_path, *[, ...])

将 JSONPath 字符串应用于输入字符串列,其中列中的每一行都是有效的 json 字符串。

hex_to_int()

返回每个十六进制字符串表示的整数值。

htoi()

返回每个十六进制字符串表示的整数值。

index(sub[, start, end])

返回每个字符串中子字符串完全包含在 [start:end] 之间的最低索引。

insert([start, repl])

在指定位置将指定字符串插入到每个字符串中。

ip2int()

这将 IP 字符串转换为整数。

ip_to_int()

这将 IP 字符串转换为整数。

is_consonant(position)

对于 position 处的字符是辅音的字符串,返回 true。

is_vowel(position)

对于 position 处的字符是元音(而不是辅音)的字符串,返回 true。

isalnum()

检查每个字符串中的所有字符是否都是字母数字。

isalpha()

检查每个字符串中的所有字符是否都是字母。

isdecimal()

检查每个字符串中的所有字符是否都是十进制数字。

isdigit()

检查每个字符串中的所有字符是否都是数字。

isempty()

检查每个字符串是否是空字符串。

isfloat()

检查每个字符串中的所有字符是否形成浮点值。

ishex()

检查每个字符串中的所有字符是否形成十六进制整数。

isinteger()

检查每个字符串中的所有字符是否形成整数。

isipv4()

检查每个字符串中的所有字符是否形成 IPv4 地址。

isspace()

检查每个字符串中的所有字符是否都是空白字符。

islower()

检查每个字符串中的所有字符是否都是小写。

isnumeric()

检查每个字符串中的所有字符是否都是数字。

isupper()

检查每个字符串中的所有字符是否都是大写。

istimestamp(format)

检查每个字符串中的所有字符是否可以使用给定格式转换为时间戳。

istitle()

检查每个字符串是否是标题格式。

jaccard_index(input, width)

计算此列与给定输入字符串列之间的 Jaccard 指数。

join([sep, string_na_rep, sep_na_rep])

使用传递的分隔符连接 Series/Index 中作为元素包含的列表。

长度()

计算 Series/Index 中每个元素的长度。

like(pat[, esc])

测试 like 模式是否匹配 Series 或 Index 的字符串。

ljust(width[, fillchar])

使用附加字符填充 Series/Index 中字符串的右侧。

小写()

将所有字符转换为小写。

lstrip([to_strip])

移除开头和结尾字符。

match(pat[, case, flags])

确定每个字符串是否匹配正则表达式。

minhash(seed, a, b, width)

计算字符串列或由术语组成的列表字符串列的 minhash。

ngrams([n, separator])

从一组令牌生成 n-gram,Series 中的每个记录被视为一个令牌。

ngrams_tokenize([n, delimiter, separator])

使用每个字符串中的令牌生成 n-gram。

normalize_characters([do_lower])

规范化字符串字符以进行分词。

规范化空格()

移除令牌之间的多余空格,并修剪每个字符串开头和结尾的空格。

pad(width[, side, fillchar])

将 Series/Index 中的字符串填充到指定宽度。

partition([sep, expand])

在 sep 的第一次出现时分割字符串。

porter_stemmer_measure()

计算每个字符串的 Porter Stemmer 度量。

repeat(repeats)

复制 Series 或 Index 中的每个字符串。

removeprefix(prefix)

从对象 Series 中移除前缀。

removesuffix(suffix)

从对象 Series 中移除后缀。

replace(pat, repl[, n, case, flags, regex])

用其他字符串替换 Series/Index 中模式/正则表达式的出现。

replace_tokens(targets, replacements[, ...])

在 Series 的每个字符串中搜索目标令牌,如果找到,则替换为相应的替换项。

replace_with_backrefs(pat, repl)

使用 repl 反向引用模板,通过使用 pat 表达式找到的提取元素创建新字符串。

rfind(sub[, start, end])

返回 Series/Index 中每个字符串中子字符串完全包含在 [start:end] 之间的最高索引。

rindex(sub[, start, end])

返回每个字符串中子字符串完全包含在 [start:end] 之间的最高索引。

rjust(width[, fillchar])

使用附加字符填充 Series/Index 中字符串的左侧。

rpartition([sep, expand])

在 sep 的最后一次出现时分割字符串。

rsplit([pat, n, expand, regex])

根据给定的分隔符分割字符串。

rstrip([to_strip])

移除开头和结尾字符。

slice([start, stop, step])

从 Series 或 Index 中的每个元素切片子字符串。

slice_from(starts, stops)

使用每个字符串的位置返回每个字符串的子字符串。

slice_replace([start, stop, repl])

将每个字符串的指定部分替换为新字符串。

split([pat, n, expand, regex])

根据给定的分隔符分割字符串。

startswith(pat)

测试每个字符串元素的开头是否匹配模式。

strip([to_strip])

移除开头和结尾字符。

转换大小写()

将每个小写字符转换为大写,反之亦然。

标题格式()

将每个单词(空格后的第一个字母)的首字母大写,其余字母小写。

token_count([delimiter])

使用提供的分隔符将每个字符串分割成令牌。

tokenize([delimiter])

使用提供的分隔符将每个字符串分割成令牌。

translate(table)

通过给定的映射表映射字符串中的所有字符。

大写()

将每个字符串转换为大写。

url_decode()

返回每个字符串的 URL 解码格式。

url_encode()

返回每个字符串的 URL 编码格式。

wrap(width, **kwargs)

将 Series/Index 中的长字符串进行换行,使其格式化为长度小于给定宽度的段落。

zfill(width)

通过在 Series/Index 中的字符串前面添加 '0' 字符进行填充。

分类访问器#

特定于分类 dtype 的方法和属性可在 Series.cat 访问器下使用。

Series.cat

Series 值的分类属性的访问器对象。

类别

此分类的类别。

是否有序

类别是否具有有序关系。

编码

返回编码 Series 以及索引。

reorder_categories(new_categories[, ordered])

按 new_categories 中指定的顺序重新排序类别。

add_categories(new_categories)

添加新类别。

remove_categories(removals)

移除指定的类别。

set_categories(new_categories[, ordered, rename])

将类别设置为指定的新类别。

设置为有序()

将 Categorical 设置为有序。

设置为无序()

将 Categorical 设置为无序。

列表处理#

Series.list 可用于将 Series 的值作为列表访问,并对其应用列表方法。可以通过 Series.list.<function/property> 的方式访问这些方法。

Series.list

Series 的列表方法。

astype(dtype)

返回一个新的列表 Series,其中叶子值被转换为指定的数据类型。

concat([dropna])

对于至少嵌套一层级的列,连接每行中的列表。

contains(search_key)

返回布尔值,指示指定的标量是否是每行的元素。

index(search_key)

返回表示每行搜索键索引的整数。

get(index[, default])

从列表 Series 中的每个列表中提取给定索引处的元素。

叶子

从(可能嵌套的)列表 Series 中,将最内层列表的元素作为平面 Series(每行一个值)获取。

长度()

计算 Series/Index 中每个元素的长度。

sort_values([ascending, inplace, kind, ...])

按值对每个列表进行排序。

take(lists_indices)

根据给定索引收集列表元素。

唯一值()

返回每个列表中的唯一元素。

结构体处理#

Series.struct 可用于将 Series 的值作为 Struct 访问,并对其应用 Struct 方法。可以通过 Series.struct.<function/property> 的方式访问这些方法。

Series.struct

Series 的 Struct 方法。

field(key)

提取 Series 中指定 Struct 列的子项。

explode()

返回一个 DataFrame,其列为此 Struct Series 的字段。

序列化 / IO / 转换#

Series.to_arrow()

转换为 PyArrow Array。

Series.to_cupy([dtype, copy, na_value])

将 Frame 转换为 CuPy 数组。

Series.to_dict([into])

将 Series 转换为 {标签 -> 值} 字典或类似字典的对象。

Series.to_dlpack()

将 cuDF 对象转换为 DLPack 张量。

Series.to_frame([name])

将 Series 转换为 DataFrame。

Series.to_hdf(path_or_buf, key, *args, **kwargs)

使用 HDFStore 将包含的数据写入 HDF5 文件。

Series.to_json([path_or_buf])

将 cuDF 对象转换为 JSON 字符串。

Series.to_numpy([dtype, copy, na_value])

将 Frame 转换为 NumPy 数组。

Series.to_pandas(*[, index, nullable, ...])

转换为 pandas Series。

Series.to_string()

转换为字符串。

Series.from_arrow(array)

从 PyArrow Array/ChunkedArray 创建。

Series.from_categorical(categorical[, codes])

从 pandas.Categorical 创建。

Series.from_masked_array(data, mask[, ...])

创建一个带有 null 掩码的 Series。

Series.from_pandas(s[, nan_as_null])

从 Pandas Series 转换。

Series.hash_values([method, seed])

计算此列中值的哈希值。

Series.to_pylibcudf([copy])

将此 Series 转换为 pylibcudf.Column。

Series.from_pylibcudf(col[, metadata])

从 pylibcudf.Column 创建 Series。