玖叶教程网

前端编程开发入门

Pandas操作完全手册(二)之Series(pandas常见操作)

Series

构造函数

Series([data, index, dtype, name, copy, …]):带轴标签的一维ndarray(包括时间序列).

属性

Axes

Series.index:系列的索引(轴标签)

Series.values:返回系列为ndarray或ndarray-like取决于dtype

Series.dtype:返回基础数据的dtype对象

Series.ftype:如果数据稀疏则返回

Series.shape:返回基础数据形状的元组

Series.nbytes:返回基础数据中的字节数

Series.ndim:根据定义1,返回基础数据的维数

Series.size:返回基础数据中的元素数量

Series.strides:返回基础数据的步幅

Series.itemsize:返回基础数据项的dtype的大小

Series.base:如果共享基础数据的内存,则返回基础对象

Series.T:返回转置,根据定义自我

Series.memory_usage([index, deep]):返回Series的内存使用情况。

Series.hasnans:如果我有任何nans,我会回来; 实现各种性能加速

Series.flags:

Series.empty:

Series.dtypes:返回基础数据的dtype对象

Series.ftypes:如果数据稀疏则返回

Series.data:返回基础数据的数据指针

Series.is_copy:

Series.name:

Series.put(*args, **kwargs):将put方法应用于其values属性(如果有)

转换

Series.astype(dtype[, copy, errors]):将pandas对象转换为指定的dtypedtype。

Series.infer_objects():尝试推断对象列的更好的dtypes。

Series.convert_objects([convert_dates, …]):(DEPRECATED)尝试推断对象列的更好dtype。

Series.copy([deep]):复制此对象的索引和数据。

Series.bool():返回单个元素PandasObject的bool。

Series.to_period([freq, copy]):将Series从DatetimeIndex转换为具有所需频率的PeriodIndex(如果未传递,则从索引推断)

Series.to_timestamp([freq, how, copy]):在期间开始时转换为时间戳的datetimedex

Series.tolist():返回值列表。

Series.get_values():与值相同(但处理稀疏转换); 是一种观点

索引, 迭代

Series.get(key[, default]):从给定键的对象获取项目(DataFrame列,Panel切片等)。

Series.at:访问行/列标签对的单个值。

Series.iat:按整数位置访问行/列对的单个值。

Series.loc:通过标签或布尔数组访问一组行和列。

Series.iloc:纯粹基于整数位置的索引,用于按位置选择。

Series.__iter__():返回值的迭代器。

Series.iteritems():懒惰地迭代(索引,值)元组

Series.items():懒惰地迭代(索引,值)元组

Series.keys():索引的别名

Series.pop(item):返回项目并从框架中删除。

Series.item():将基础数据的第一个元素作为python标量返回

Series.xs(key[, axis, level, drop_level]):返回Series / DataFrame的横截面(行或列)。

For more information on .at, .iat, .loc, and .iloc, see the indexing documentation

二元运算符函数

Series.add(other[, level, fill_value, axis]):添加系列和其他元素(二元运算符添加)。

Series.sub(other[, level, fill_value, axis]):减去序列和其他元素(二元运算符)。

Series.mul(other[, level, fill_value, axis]):系列和其他的乘法,元素(二元运算符mul)。

Series.div(other[, level, fill_value, axis]):系列和其他的浮动划分,元素方式(二元算子truediv)。

Series.truediv(other[, level, fill_value, axis]):系列和其他的浮动划分,元素方式(二元算子truediv)。

Series.floordiv(other[, level, fill_value, axis]):系列和其他的整数除法,元素方式(二元运算符floordiv)。

Series.mod(other[, level, fill_value, axis]):系列和其他的模数,元素方式(二元运算符mod)。

Series.pow(other[, level, fill_value, axis]):系列和其他元素的指数幂(二元运算符pow)。

Series.radd(other[, level, fill_value, axis]):添加系列和其他元素(二元运算符radd)。

Series.rsub(other[, level, fill_value, axis]):减去序列和其他元素(二元运算符rsub)。

Series.rmul(other[, level, fill_value, axis]):系列和其他的乘法,元素(二元运算符rmul)。

Series.rdiv(other[, level, fill_value, axis]):系列和其他的浮动划分,元素方式(二元算子rtruediv)。

Series.rtruediv(other[, level, fill_value, axis]):系列和其他的浮动划分,元素方式(二元算子rtruediv)。

Series.rfloordiv(other[, level, fill_value, …]):系列和其他的整数除法,元素方式(二元运算符rfloordiv)。

Series.rmod(other[, level, fill_value, axis]):系列和其他的模数,元素方式(二元运算符rmod)。

Series.rpow(other[, level, fill_value, axis]):系列和其他元素的指数幂(二元运算符rpow)。

Series.combine(other, func[, fill_value]):当一个系列或另一个系列中缺少索引时,使用给定函数对两个系列执行元素二进制运算,并带有可选填充值

Series.combine_first(other):组合系列值,首先选择调用Series的值。

Series.round([decimals]):将系列中的每个值舍入到给定的小数位数。

Series.lt(other[, level, fill_value, axis]):少于系列和其他元素(二元运算符lt)。

Series.gt(other[, level, fill_value, axis]):大于系列和其他元素(二元运算符gt)。

Series.le(other[, level, fill_value, axis]):小于或等于系列等,逐元素(二元运算)。

Series.ge(other[, level, fill_value, axis]):大于或等于系列和其他元素(二元运算符ge)。

Series.ne(other[, level, fill_value, axis]):不等于系列和其他元素(二元运算符ne)。

Series.eq(other[, level, fill_value, axis]):等于系列和其他元素(二元运算符eq)。

Series.product([axis, skipna, level, …]):返回请求轴的值的乘积

Series.dot(other):矩阵乘法与DataFrame或内部产品与Series对象。

Function application, GroupBy & Window

Series.apply(func[, convert_dtype, args]):调用Series的值的函数。

Series.agg(func[, axis]):使用指定轴上的一个或多个操作进行聚合。

Series.aggregate(func[, axis]):使用指定轴上的一个或多个操作进行聚合。

Series.transform(func, *args, **kwargs):调用函数生成类似索引的NDFrame并返回带有转换值的NDFrame

Series.map(arg[, na_action]):使用输入对应(字典,系列或函数)映射Series的值。

Series.groupby([by, axis, level, as_index, …]):使用mapper(dict或key函数,将给定函数应用于组,将结果作为系列返回)或通过一系列列的组系列。

Series.rolling(window[, min_periods, …]):提供滚动窗口计算。

Series.expanding([min_periods, center, axis]):提供扩展转换。

Series.ewm([com, span, halflife, alpha, …]):提供指数加权函数

Series.pipe(func, *args, **kwargs):应用func(self,* args,** kwargs)

计算/ 描述性统计

Series.abs():返回具有每个元素的绝对数值的Series / DataFrame。

Series.all([axis, bool_only, skipna, level]):返回是否所有元素都是True,可能是在轴上。

Series.any([axis, bool_only, skipna, level]):返回任何元素在请求的轴上是否为True。

Series.autocorr([lag]):Lag-N自相关

Series.between(left, right[, inclusive]):返回boolean Series等效于left <= series <= right。

Series.clip([lower, upper, axis, inplace]):在输入阈值处修剪值。

Series.clip_lower(threshold[, axis, inplace]):返回值低于阈值截断的输入的副本。

Series.clip_upper(threshold[, axis, inplace]):输入的返回副本,其值超过给定值(截断)。

Series.corr(other[, method, min_periods]):计算与其他系列的相关性,不包括缺失值

Series.count([level]):返回系列中非NA / null观测值的返回数

Series.cov(other[, min_periods]):计算与Series的协方差,不包括缺失值

Series.cummax([axis, skipna]):返回DataFrame或Series轴上的累积最大值。

Series.cummin([axis, skipna]):返回DataFrame或Series轴上的累积最小值。

Series.cumprod([axis, skipna]):通过DataFrame或Series轴返回累积产品。

Series.cumsum([axis, skipna]):返回DataFrame或Series轴上的累积和。

Series.describe([percentiles, include, exclude]):生成描述性统计数据,总结数据集分布的集中趋势,分散和形状,不包括NaN值。

Series.diff([periods]):第一个离散的元素差异。

Series.factorize([sort, na_sentinel]):将对象编码为枚举类型或分类变量。

Series.kurt([axis, skipna, level, numeric_only]):使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。

Series.mad([axis, skipna, level]):返回请求轴的值的平均绝对偏差

Series.max([axis, skipna, level, numeric_only]):此方法返回对象中的最大值。

Series.mean([axis, skipna, level, numeric_only]):返回请求轴的值的平均值

Series.median([axis, skipna, level, …]):返回请求轴的值的中值

Series.min([axis, skipna, level, numeric_only]):此方法返回对象中的最小值。

Series.mode():返回数据集的模式。

Series.nlargest([n, keep]):返回最大的n个元素。

Series.nsmallest([n, keep]):返回最小的n个元素。

Series.pct_change([periods, fill_method, …]):当前元素和先前元素之间的百分比变化。

Series.prod([axis, skipna, level, …]):返回请求轴的值的乘积

Series.quantile([q, interpolation]):给定分位数处的返回值,即la numpy.percentile。

Series.rank([axis, method, numeric_only, …]):沿轴计算数值数据等级(1到n)。

Series.sem([axis, skipna, level, ddof, …]):在请求的轴上返回均值的无偏标准误差。

Series.skew([axis, skipna, level, numeric_only]):返回请求轴的无偏偏差,由N-1归一化

Series.std([axis, skipna, level, ddof, …]):返回请求轴上的样本标准偏差。

Series.sum([axis, skipna, level, …]):返回请求轴的值的总和

Series.var([axis, skipna, level, ddof, …]):在请求的轴上返回无偏差异。

Series.kurtosis([axis, skipna, level, …]):使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。

Series.unique():返回Series对象的唯一值。

Series.nunique([dropna]):返回对象中唯一元素的数量。

Series.is_unique:如果对象中的值是唯一的,则返回布尔值

Series.is_monotonic:如果对象中的值是monotonic_increasing,则返回布尔值

Series.is_monotonic_increasing:如果对象中的值是monotonic_increasing,则返回布尔值

Series.is_monotonic_decreasing:如果对象中的值是monotonic_decreasing,则返回布尔值

Series.value_counts([normalize, sort, …]):返回包含唯一值计数的对象。

Series.compound([axis, skipna, level]):返回请求轴的值的复合百分比

Series.nonzero():返回非零元素的整数索引

Series.ptp([axis, skipna, level, numeric_only]):返回最大值和之间的差值

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

Series.align(other[, join, axis, level, …]):使用指定的每个轴索引的连接方法将轴上的两个对象对齐

Series.drop([labels, axis, index, columns, …]):返回已删除指定索引标签的系列。

Series.drop_duplicates([keep, inplace]):返回系列,删除重复值。

Series.duplicated([keep]):指示重复的系列值。

Series.equals(other):确定两个NDFrame对象是否包含相同的元素。

Series.first(offset):用于基于日期偏移量化时间序列数据的初始时段的便捷方法。

Series.head([n]):返回前n行。

Series.idxmax([axis, skipna]):返回最大值的行标签。

Series.idxmin([axis, skipna]):返回最小值的行标签。

Series.isin(values):检查系列中是否包含

Series.last(offset):用于基于日期偏移量化时间序列数据的最终时段的便捷方法。

Series.reindex([index]):使用可选填充逻辑将系列符合到新索引,将NA / NaN放置在先前索引中没有值的位置。

Series.reindex_like(other[, method, copy, …]):将具有匹配索引的对象返回给我自己。

Series.rename([index]):更改系列索引标签或名称

Series.rename_axis(mapper[, axis, copy, inplace]):更改索引或列的名称。

Series.reset_index([level, drop, name, inplace]):使用索引重置生成新的DataFrame或Series。

Series.sample([n, frac, replace, weights, …]):从对象轴返回随机的项目样本。

Series.select(crit[, axis]):(DEPRECATED)返回与轴标签匹配条件对应的数据

Series.set_axis(labels[, axis, inplace]):将所需索引分配给给定轴。

Series.take(indices[, axis, convert, is_copy]):沿轴返回给定位置索引中的元素。

Series.tail([n]):返回最后n行。

Series.truncate([before, after, axis, copy]):在某个索引值之前和之后截断Series或DataFrame。

Series.where(cond[, other, inplace, axis, …]):返回与self相同形状的对象,其对应的条目来自self,其中cond为True,否则来自其他

Series.mask(cond[, other, inplace, axis, …]):返回与self相同形状的对象,其对应的条目来自self,其中cond为False,否则来自other

Series.add_prefix(prefix):带有字符串前缀的前缀标签。

Series.add_suffix(suffix):带有字符串后缀的后缀标签。

Series.filter([items, like, regex, axis]):根据指定索引中的标签设置数据框的行或列。

缺少数据处理

Series.isna():检测缺失值。

Series.notna():检测现有(非缺失)值。

Series.dropna([axis, inplace]):返回删除了缺失值的新系列。

Series.fillna([value, method, axis, …]):使用指定的方法填充NA / NaN值

Series.interpolate([method, axis, limit, …]):根据不同的方法插值。

重塑, 排序

Series.argsort([axis, kind, order]):覆盖ndarray.argsort。

Series.reorder_levels(order):使用输入顺序重新排列索引级别。

Series.sort_values([axis, ascending, …]):按值排序。

Series.sort_index([axis, level, ascending, …]):按索引标签排序系列。

Series.swaplevel([i, j, copy]):在MultiIndex中交换i和j级别

Series.unstack([level, fill_value]):Unstack,又名

Series.searchsorted(value[, side, sorter]):查找应插入元素以维护顺序的索引。

Series.ravel([order]):将展平的底层数据作为ndarray返回

Series.repeat(repeats, *args, **kwargs):重复系列的元素。

Series.squeeze([axis]):挤压长度1维。

Series.view([dtype]):创建系列的新视图。

合并/ 加入

Series.append(to_append[, ignore_index, …]):连接两个或更多系列

Series.replace([to_replace, value, inplace, …]):替换给定的值to_replace价值.

Series.update(other):使用传递的Series中的非NA值修改系列

时间序列

Series.asfreq(freq[, method, how, …]):将TimeSeries转换为指定的频率。

Series.asof(where[, subset]):获取没有任何NaN的最后一行(或者在没有NaN的情况下考虑仅使用DataFrame情况下的列子集的最后一行)

Series.shift([periods, freq, axis]):使用可选的时间频率按期望的周期数移动索引

Series.first_valid_index():返回第一个非NA / null值的索引。

Series.last_valid_index():返回最后一个非NA / null值的索引。

Series.resample(rule[, how, axis, …]):频率转换和时间序列重采样的便捷方法。

Series.tz_convert(tz[, axis, level, copy]):将tz感知轴转换为目标时区。

Series.tz_localize(tz[, axis, level, copy, …]):将tz-naive TimeSeries本地化为目标时区。

Series.at_time(time[, asof]):在特定时间选择值(例如,

Series.between_time(start_time, end_time[, …]):选择一天中特定时间之间的值(例如,上午9:00-9:30)。

Series.tshift([periods, freq, axis]):如果可用,使用索引的频率来移动时间索引。

Series.slice_shift([periods, axis]):相当于移位而不复制数据。

类似日期的属性

Series.dt可用于以datetimelike的形式访问系列的值并返回多个属性。这些可以像访问Series.dt.<property>.

日期时间属性

Series.dt.date:返回numpy数组的python datetime.date对象(即没有时区信息的Timestamps的日期部分)。

Series.dt.time:返回datetime.time的numpy数组。

Series.dt.year:日期时间

Series.dt.month:月份为1月= 1,12月= 12

Series.dt.day:日期时间的日子

Series.dt.hour:日期时间

Series.dt.minute:日期时间的分钟

Series.dt.second:日期时间的秒数

Series.dt.microsecond:日期时间的微秒

Series.dt.nanosecond:日期时间的纳秒

Series.dt.week:一年中的一周序数

Series.dt.weekofyear:一年中的一周序数

Series.dt.dayofweek:星期一= 0,星期日= 6的星期几

Series.dt.weekday:星期一= 0,星期日= 6的星期几

Series.dt.dayofyear:一年中的序数日

Series.dt.quarter:日期的四分之一

Series.dt.is_month_start:逻辑指示是否每月的第一天(由频率定义)

Series.dt.is_month_end:指示日期是否是该月的最后一天。

Series.dt.is_quarter_start:指示日期是否是一个季度的第一天。

Series.dt.is_quarter_end:指示日期是否是一个季度的最后一天。

Series.dt.is_year_start:指明日期是否是一年的第一天。

Series.dt.is_year_end:指明日期是一年中的最后一天。

Series.dt.is_leap_year:布尔指示符,如果日期属于闰年。

Series.dt.daysinmonth:本月的天数

Series.dt.days_in_month:本月的天数

日期时间方法

Series.dt.to_period(*args, **kwargs):以特定频率转换为PeriodIndex。

Series.dt.to_pydatetime():将数据作为本机Python日期时间对象的数组返回

Series.dt.tz_localize(*args, **kwargs):将tz-naive DatetimeIndex本地化为tz-aware DatetimeIndex。

Series.dt.tz_convert(*args, **kwargs):将tz-aware DatetimeIndex从一个时区转换为另一个时区。

Series.dt.normalize(*args, **kwargs):将时间转换为午夜。

Series.dt.strftime(*args, **kwargs):使用指定的date_format转换为Index。

Series.dt.round(*args, **kwargs):将数据舍入到指定的频率

Series.dt.floor(*args, **kwargs):将数据置于指定的频率

Series.dt.ceil(*args, **kwargs):将数据ceil到指定的频率

Series.dt.month_name(*args, **kwargs):返回具有指定语言环境的DateTimeIndex的月份名称。

Series.dt.day_name(*args, **kwargs):返回具有指定语言环境的DateTimeIndex的日期名称。

Timedelta 属性

Series.dt.days:每个元素的天数。

Series.dt.seconds:每个元素的秒数(> = 0且小于1天)。

Series.dt.microseconds:每个元素的微秒数(> = 0且小于1秒)。

Series.dt.nanoseconds:每个元素的纳秒数(> = 0且小于1微秒)。

Series.dt.components:返回Timedeltas的组件(天,小时,分钟,秒,毫秒,微秒,纳秒)的数据帧。

Timedelta 方法

Series.dt.to_pytimedelta():返回本机datetime.timedelta对象的数组.

Series.dt.total_seconds(*args, **kwargs):返回每个元素的总持续时间,以秒为单位表示

字符串处理

Series.str可用于以字符串形式访问系列的值,并对其应用多种方法。这些可以像访问Series.str.<function/property>.

Series.str.capitalize():将Series / Index中的字符串转换为大写。

Series.str.cat([others, sep, na_rep, join]):使用给定的分隔符连接Series / Index中的字符串。

Series.str.center(width[, fillchar]):使用附加字符填充系列/索引中字符串的左侧和右侧。

Series.str.contains(pat[, case, flags, na, …]):测试模式或正则表达式是否包含在系列或索引的字符串中。

Series.str.count(pat[, flags]):计算系列/索引的每个字符串中模式的出现次数。

Series.str.decode(encoding[, errors]):使用指定的编码解码系列/索引中的字符串。

Series.str.encode(encoding[, errors]):使用指定的编码对系列/索引中的字符串进行编码。

Series.str.endswith(pat[, na]):测试每个字符串元素的结尾是否与模式匹配。

Series.str.extract(pat[, flags, expand]):对于系列中的每个主题字符串,从正则表达式pat的第一个匹配中提取组。

Series.str.extractall(pat[, flags]):对于系列中的每个主题字符串,从正则表达式pat的所有匹配中提取组。

Series.str.find(sub[, start, end]):返回Series / Index中每个字符串中的最低索引,其中子字符串完全包含在[start:end]之间。

Series.str.findall(pat[, flags]):在系列/索引中查找所有出现的模式或正则表达式。

Series.str.get(i):从指定位置的每个组件中提取元素。

Series.str.index(sub[, start, end]):返回每个字符串中的最低索引,其中子字符串完全包含在[start:end]之间。

Series.str.join(sep):使用传递的分隔符连接包含在Series / Index中的元素的列表。

Series.str.len():计算系列/索引中每个字符串的长度。

Series.str.ljust(width[, fillchar]):使用附加字符填充系列/索引中字符串的右侧。

Series.str.lower():将Series / Index中的字符串转换为小写。

Series.str.lstrip([to_strip]):从左侧的系列/索引中的每个字符串中删除空格(包括换行符)。

Series.str.match(pat[, case, flags, na, …]):确定每个字符串是否与正则表达式匹配。

Series.str.normalize(form):返回Series / Index中字符串的Unicode普通表单。

Series.str.pad(width[, side, fillchar]):在系列/索引中填充字符串,并在指定的一侧添加一个字符。

Series.str.partition([pat, expand]):在第一次出现sep时拆分字符串,并返回包含分隔符之前的部分的3个元素,分隔符本身以及分隔符之后的部分。

Series.str.repeat(repeats):按指定的次数复制系列/索引中的每个字符串。

Series.str.replace(pat, repl[, n, case, …]):用一些其他字符串替换Series / Index中出现的pattern / regex。

Series.str.rfind(sub[, start, end]):返回Series / Index中每个字符串中的最高索引,其中子字符串完全包含在[start:end]之间。

Series.str.rindex(sub[, start, end]):返回每个字符串中的最高索引,其中子字符串完全包含在[start:end]之间。

Series.str.rjust(width[, fillchar]):使用附加字符填充系列/索引中字符串的左侧。

Series.str.rpartition([pat, expand]):在最后一次出现sep时拆分字符串,并返回包含分隔符之前的部分的3个元素,分隔符本身以及分隔符之后的部分。

Series.str.rstrip([to_strip]):从右侧的系列/索引中的每个字符串中删除空格(包括换行符)。

Series.str.slice([start, stop, step]):从系列/索引中的每个元素切片子串

Series.str.slice_replace([start, stop, repl]):用另一个值替换字符串的位置切片。

Series.str.split([pat, n, expand]):在给定的分隔符/分隔符周围拆分字符串。

Series.str.rsplit([pat, n, expand]):通过给定的分隔符字符串拆分Series / Index中的每个字符串,从字符串的末尾开始并向前工作。

Series.str.startswith(pat[, na]):测试每个字符串元素的开头是否与模式匹配。

Series.str.strip([to_strip]):从左侧和右侧剥离系列/索引中每个字符串的空白(包括换行符)。

Series.str.swapcase():将Series / Index中的字符串转换为swapcased。

Series.str.title():将系列/索引中的字符串转换为标题。

Series.str.translate(table[, deletechars]):通过给定的映射表映射字符串中的所有字符。

Series.str.upper():将Series / Index中的字符串转换为大写。

Series.str.wrap(width, **kwargs):将Series / Index中的长字符串换行,以长度小于给定宽度的段落格式化。

Series.str.zfill(width):使用0填充Series / Index中字符串的左侧。

Series.str.isalnum():检查Series / Index中每个字符串中的所有字符是否为字母数字。

Series.str.isalpha():检查Series / Index中每个字符串中的所有字符是否都是字母。

Series.str.isdigit():检查Series / Index中每个字符串中的所有字符是否为数字。

Series.str.isspace():检查Series / Index中每个字符串中的所有字符是否都是空格。

Series.str.islower():检查Series / Index中每个字符串中的所有字符是否都是小写。

Series.str.isupper():检查Series / Index中每个字符串中的所有字符是否都是大写。

Series.str.istitle():检查Series / Index中每个字符串中的所有字符是否都是标题。

Series.str.isnumeric():检查Series / Index中每个字符串中的所有字符是否都是数字。

Series.str.isdecimal():检查Series / Index中每个字符串中的所有字符是否为十进制。

Series.str.get_dummies([sep]):用sep拆分Series中的每个字符串,并返回一个虚拟/指示变量框。

如果Series是dtype CategoricalDtype,Series.cat则可用于更改分类数据。此访问器类似于Series.dt或Series.str具有以下可用方法和属性:

Series.cat.categories:这种分类的类别。

Series.cat.ordered:类别是否具有有序关系

Series.cat.rename_categories(*args, **kwargs):重命名类别。

Series.cat.reorder_categories(*args, **kwargs):重新排序new_categories中指定的类别。

Series.cat.add_categories(*args, **kwargs):添加新类别。

Series.cat.remove_categories(*args, **kwargs):删除指定的类别。

Series.cat.remove_unused_categories(*args, …):删除未使用的类别。

Series.cat.set_categories(*args, **kwargs):将类别设置为指定的new_categories。

Series.cat.as_ordered(*args, **kwargs):设置要排序的分类

Series.cat.as_unordered(*args, **kwargs):将Categorical设置为无序

绘图

Series.plot对于表单的特定绘图方法,它既是可调用方法又是命名空间属性Series.plot.<kind>.

Series.plot([kind, ax, figsize, ….]):系列绘图访问器和方法

Series.hist([by, ax, grid, xlabelsize, …]):使用matplotlib绘制输入序列的直方图

Series.plot.area(**kwds):区域情节

Series.plot.bar(**kwds):垂直条形图

Series.plot.barh(**kwds):单杠图

Series.plot.box(**kwds):箱形图

Series.plot.density([bw_method, ind]):使用高斯核生成核密度估计图。

Series.plot.hist([bins]):直方图

Series.plot.kde([bw_method, ind]):使用高斯核生成核密度估计图。

Series.plot.line(**kwds):线图

Series.plot.pie(**kwds):饼形图

序列化/ IO / 转换

Series.to_pickle(path[, compression, protocol]):Pickle(序列化)对象到文件。

Series.to_csv([path, index, sep, na_rep, …]):将Series写入逗号分隔值(csv)文件

Series.to_dict([into]):将Series转换为{label - > value} dict或dict-like对象。

Series.to_excel(excel_writer[, sheet_name, …]):将系列写入Excel工作表

Series.to_frame([name]):将Series转换为DataFrame

Series.to_xarray():从pandas对象返回一个xarray对象。

Series.to_hdf(path_or_buf, key, **kwargs):使用HDFStore将包含的数据写入HDF5文件。

Series.to_sql(name, con[, schema, …]):将存储在DataFrame中的记录写入SQL数据库。

Series.to_msgpack([path_or_buf, encoding]):msgpack(序列化)对象输入文件路径

Series.to_json([path_or_buf, orient, …]):将对象转换为JSON字符串。

Series.to_sparse([kind, fill_value]):将Series转换为SparseSeries

Series.to_dense():返回NDFrame的密集表示(与稀疏相反)

Series.to_string([buf, na_rep, …]):渲染系列的字符串表示形式

Series.to_clipboard([excel, sep]):将对象复制到系统剪贴板。

Series.to_latex([buf, columns, col_space, …]):将对象渲染到表格环境表。

Sparse

SparseSeries.to_coo([row_levels, …]):使用MultiIndex从SparseSeries创建scipy.sparse.coo_matrix.

SparseSeries.from_coo(A[, dense_index]):从scipy.sparse.coo_matrix创建SparseSeries.

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言