首先要明确pandas是做什么的,在确定是如何做的,通过哪些方式去做的?
pandas是做什么的?
Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。Pandas 纳入了大量库和一些标准的数据模型,提供了高效地操作大型数据集所需的工具。pandas提供了大量能使我们快速便捷地处理数据的函数和方法。你很快就会发现,它是使Python成为强大而高效的数据分析环境的重要因素之一。简单总结就是处理大型数据的工具,我们生活中常用地数据处理软件是微软的Excel,当你学会pandas时候,你会发现pandas比Excel好用太多了。
如何做的或者是如何处理数据的?
简单的来说pandas只有两种数据类型,Series和DataFrame,Series你可以简单的理解为Excel中的行或者列,DataFrame可以理解为整个Excel表格,当然这只是形象的理解,实际上他们的功能要比Excel灵活的多。
Series:一维数组,与Numpy中的一维array类似。二者与Python基本的数据结构List也很相近。Series如今能保存不同种数据类型,字符串、boolean值、数字等都能保存在Series中。
Time- Series:以时间为索引的Series。
DataFrame:二维的表格型数据结构。很多功能与R中的data.frame类似。可以将DataFrame理解为Series的容器。以下的内容主要以DataFrame为主。
Panel :三维的数组,可以理解为DataFrame的容器。
详细介绍两种类型:
pandas.Series
class pandas.Series(data = None,index = None,dtype = None,name = None,copy = False,fastpath = False )
带轴标签的一维ndarray(包括时间序列)。
标签不一定是唯一的,但必须是可清洗的类型。该对象支持基于整数和基于标签的索引,并提供了许多方法来执行涉及索引的操作。来自ndarray的统计方法已被覆盖,以自动排除缺失的数据(目前表示为NaN)。
Series(+, - ,/ ,, *)之间的操作根据其关联的索引值对齐值 - 它们不必是相同的长度。结果索引将是两个索引的排序并集。
| 参数: | data:array-like,dict或scalar value
index:array-like或Index(1d)
D型:numpy.dtype或无
copy:boolean,默认为False
|
|---|
属性
T | 返回转置 |
asobject | 返回对象包含盒装值的系列。 |
at | 访问行/列标签对的单个值。 |
axes | 返回行轴标签的列表 |
base | 如果共享基础数据的内存,则返回基础对象 |
blocks | (已弃用)as_blocks()的内部属性,属性同义词 |
data | 返回基础数据的数据指针 |
dtype | 返回基础数据的dtype对象 |
dtypes | 返回基础数据的dtype对象 |
flags | |
ftype | 如果数据稀疏则返回 |
ftypes | 如果数据稀疏则返回 |
hasnans | 如果我有任何nans,我会回来; 实现各种性能加速 |
iat | 按整数位置访问行/列对的单个值。 |
iloc | 纯粹基于整数位置的索引,用于按位置选择。 |
index | 系列的索引(轴标签)。 |
is_monotonic | 如果对象中的值是monotonic_increasing,则返回布尔值 |
is_monotonic_decreasing | 如果对象中的值是monotonic_decreasing,则返回布尔值 |
is_monotonic_increasing | 如果对象中的值是monotonic_increasing,则返回布尔值 |
is_unique | 如果对象中的值是唯一的,则返回布尔值 |
itemsize | 返回基础数据项的dtype的大小 |
ix | 主要基于标签位置的索引器,具有整数位置回退。 |
loc | 通过标签或布尔数组访问一组行和列。 |
nbytes | 返回基础数据中的字节数 |
ndim | 根据定义1,返回基础数据的维数 |
shape | 返回基础数据形状的元组 |
size | 返回基础数据中的元素数量 |
strides | 返回基础数据的步幅 |
values | 返回系列为ndarray或ndarray-like取决于dtype |
方法
| abs() | 返回具有每个元素的绝对数值的Series / DataFrame。 |
| add(other[, level, fill_value, axis]) | 添加系列和其他元素(二元运算符添加)。 |
| add_prefix(prefix) | 带有字符串前缀的前缀标签。 |
| add_suffix(suffix) | 带有字符串后缀的后缀标签。 |
| agg(func[, axis]) | 使用指定轴上的一个或多个操作进行聚合。 |
| aggregate(func[, axis]) | 使用指定轴上的一个或多个操作进行聚合。 |
| align(other[, join, axis, level, copy, …]) | 使用指定的每个轴索引的连接方法将轴上的两个对象对齐 |
| all([axis, bool_only, skipna, level]) | 返回是否所有元素都是True,可能是在轴上。 |
| any([axis, bool_only, skipna, level]) | 返回任何元素在请求的轴上是否为True。 |
| append(to_append[, ignore_index, …]) | 连接两个或更多系列。 |
| apply(func[, convert_dtype, args]) | 调用Series的值的函数。 |
| argmax([axis, skipna]) | (已弃用)..已弃用:: 0.21.0 |
| argmin([axis, skipna]) | (已弃用)..已弃用:: 0.21.0 |
| argsort([axis, kind, order]) | 覆盖ndarray.argsort。 |
| as_blocks([copy]) | (已弃用)将帧转换为dtype - >构造函数类型的dict,每个类型都具有同类dtype。 |
| as_matrix([columns]) | (DEPRECATED)将帧转换为Numpy数组表示。 |
| asfreq(freq[, method, how, normalize, …]) | 将TimeSeries转换为指定的频率。 |
| asof(where[, subset]) | 获取没有任何NaN的最后一行(或者在没有NaN的情况下考虑仅使用DataFrame情况下的列子集的最后一行) |
| astype(dtype[, copy, errors]) | 将pandas对象转换为指定的dtype dtype。 |
| at_time(time[, asof]) | 在特定时间选择值(例如, |
| autocorr([lag]) | Lag-N自相关 |
| between(left, right[, inclusive]) | 返回boolean Series等效于left <= series <= right。 |
| between_time(start_time, end_time[, …]) | 选择一天中特定时间之间的值(例如,上午9:00-9:30)。 |
| bfill([axis, inplace, limit, downcast]) | 同义词 DataFrame.fillna(method='bfill') |
| bool() | 返回单个元素PandasObject的bool。 |
| cat | 别名 pandas.core.arrays.categorical.CategoricalAccessor |
| clip([lower, upper, axis, inplace]) | 在输入阈值处修剪值。 |
| clip_lower(threshold[, axis, inplace]) | 返回值低于阈值截断的输入的副本。 |
| clip_upper(threshold[, axis, inplace]) | 输入的返回副本,其值超过给定值(截断)。 |
| combine(other, func[, fill_value]) | 当一个系列或另一个系列中缺少索引时,使用给定函数对两个系列执行元素二进制运算,并带有可选填充值 |
| combine_first(other) | 组合系列值,首先选择调用Series的值。 |
| compound([axis, skipna, level]) | 返回请求轴的值的复合百分比 |
| compress(condition, *args, **kwargs) | 沿给定轴返回选定的阵列切片作为系列 |
| consolidate([inplace]) | (已弃用)使用“合并”内部构件计算NDFrame(每个dtype的数据在单个ndarray中组合在一起)。 |
| convert_objects([convert_dates, …]) | (DEPRECATED)尝试推断对象列的更好dtype。 |
| copy([deep]) | 复制此对象的索引和数据。 |
| corr(other[, method, min_periods]) | 计算与其他系列的相关性,不包括缺失值 |
| count([level]) | 返回系列中非NA / null观测值的返回数 |
| cov(other[, min_periods]) | 计算与Series的协方差,不包括缺失值 |
| cummax([axis, skipna]) | 返回DataFrame或Series轴上的累积最大值。 |
| cummin([axis, skipna]) | 返回DataFrame或Series轴上的累积最小值。 |
| cumprod([axis, skipna]) | 通过DataFrame或Series轴返回累积产品。 |
| cumsum([axis, skipna]) | 返回DataFrame或Series轴上的累积和。 |
| describe([percentiles, include, exclude]) | 生成描述性统计数据,总结数据集分布的集中趋势,分散和形状,不包括NaN值。 |
| diff([periods]) | 第一个离散的元素差异。 |
| div(other[, level, fill_value, axis]) | 系列和其他的浮动划分,元素方式(二元算子truediv)。 |
| divide(other[, level, fill_value, axis]) | 系列和其他的浮动划分,元素方式(二元算子truediv)。 |
| divmod(other[, level, fill_value, axis]) | 系列和其他的整数除法和模数,元素方式(二元运算符divmod)。 |
| dot(other) | 矩阵乘法与DataFrame或内部产品与Series对象。 |
| drop([labels, axis, index, columns, level, …]) | 返回已删除指定索引标签的系列。 |
| drop_duplicates([keep, inplace]) | 返回系列,删除重复值。 |
| dropna([axis, inplace]) | 返回删除了缺失值的新系列。 |
| dt | 别名 pandas.core.indexes.accessors.CombinedDatetimelikeProperties |
| duplicated([keep]) | 指示重复的系列值。 |
| eq(other[, level, fill_value, axis]) | 等于系列和其他元素(二元运算符eq)。 |
| equals(other) | 确定两个NDFrame对象是否包含相同的元素。 |
| ewm([com, span, halflife, alpha, …]) | 提供指数加权函数 |
| expanding([min_periods, center, axis]) | 提供扩展转换。 |
| factorize([sort, na_sentinel]) | 将对象编码为枚举类型或分类变量。 |
| ffill([axis, inplace, limit, downcast]) | 同义词 DataFrame.fillna(method='ffill') |
| fillna([value, method, axis, inplace, …]) | 使用指定的方法填充NA / NaN值 |
| filter([items, like, regex, axis]) | 根据指定索引中的标签设置数据框的行或列。 |
| first(offset) | 用于基于日期偏移量化时间序列数据的初始时段的便捷方法。 |
| first_valid_index() | 返回第一个非NA / null值的索引。 |
| floordiv(other[, level, fill_value, axis]) | 系列和其他的整数除法,元素方式(二元运算符floordiv)。 |
| from_array(arr[, index, name, dtype, copy, …]) | 从数组构造系列。 |
| from_csv(path[, sep, parse_dates, header, …]) | (已弃用)读取CSV文件。 |
| ge(other[, level, fill_value, axis]) | 大于或等于系列和其他元素(二元运算符ge)。 |
| get(key[, default]) | 从给定键的对象获取项目(DataFrame列,Panel切片等)。 |
| get_dtype_counts() | 返回此对象中唯一dtypes的计数。 |
| get_ftype_counts() | (DEPRECATED)返回此对象中唯一ftypes的计数。 |
| get_value(label[, takeable]) | (DEPRECATED)在传递的索引标签处快速检索单个值 |
| get_values() | 与值相同(但处理稀疏转换); 是一种观点 |
| groupby([by, axis, level, as_index, sort, …]) | 使用mapper(dict或key函数,将给定函数应用于组,将结果作为系列返回)或通过一系列列的组系列。 |
| gt(other[, level, fill_value, axis]) | 大于系列和其他元素(二元运算符gt)。 |
| head([n]) | 返回前n行。 |
| hist([by, ax, grid, xlabelsize, xrot, …]) | 使用matplotlib绘制输入序列的直方图 |
| idxmax([axis, skipna]) | 返回最大值的行标签。 |
| idxmin([axis, skipna]) | 返回最小值的行标签。 |
| infer_objects() | 尝试推断对象列的更好的dtypes。 |
| interpolate([method, axis, limit, inplace, …]) | 根据不同的方法插值。 |
| isin(values) | 检查系列中是否包含值。 |
| isna() | 检测缺失值。 |
| isnull() | 检测缺失值。 |
| item() | 将基础数据的第一个元素作为python标量返回 |
| items() | 懒惰地迭代(索引,值)元组 |
| iteritems() | 懒惰地迭代(索引,值)元组 |
| keys() | 索引的别名 |
| kurt([axis, skipna, level, numeric_only]) | 使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。 |
| kurtosis([axis, skipna, level, numeric_only]) | 使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。 |
| last(offset) | 用于基于日期偏移量化时间序列数据的最终时段的便捷方法。 |
| last_valid_index() | 返回最后一个非NA / null值的索引。 |
| le(other[, level, fill_value, axis]) | 小于或等于系列等,逐元素(二元运算乐)。 |
| lt(other[, level, fill_value, axis]) | 少于系列和其他元素(二元运算符lt)。 |
| mad([axis, skipna, level]) | 返回请求轴的值的平均绝对偏差 |
| map(arg[, na_action]) | 使用输入对应(字典,系列或函数)映射Series的值。 |
| mask(cond[, other, inplace, axis, level, …]) | 返回与self相同形状的对象,其对应的条目来自self,其中cond为False,否则来自other。 |
| max([axis, skipna, level, numeric_only]) | 此方法返回对象中的最大值。 |
| mean([axis, skipna, level, numeric_only]) | 返回请求轴的值的平均值 |
| median([axis, skipna, level, numeric_only]) | 返回请求轴的值的中值 |
| memory_usage([index, deep]) | 返回Series的内存使用情况。 |
| min([axis, skipna, level, numeric_only]) | 此方法返回对象中的最小值。 |
| mod(other[, level, fill_value, axis]) | 系列和其他的模数,元素方式(二元运算符mod)。 |
| mode() | 返回数据集的模式。 |
| mul(other[, level, fill_value, axis]) | 系列和其他的乘法,元素(二元运算符mul)。 |
| multiply(other[, level, fill_value, axis]) | 系列和其他的乘法,元素(二元运算符mul)。 |
| ne(other[, level, fill_value, axis]) | 不等于系列和其他元素(二元运算符ne)。 |
| nlargest([n, keep]) | 返回最大的n个元素。 |
| nonzero() | 返回非零元素的整数索引 |
| notna() | 检测现有(非缺失)值。 |
| notnull() | 检测现有(非缺失)值。 |
| nsmallest([n, keep]) | 返回最小的n个元素。 |
| nunique([dropna]) | 返回对象中唯一元素的数量。 |
| pct_change([periods, fill_method, limit, freq]) | 当前元素和先前元素之间的百分比变化。 |
| pipe(func, *args, **kwargs) | 应用func(self,* args,** kwargs) |
| plot | 别名 pandas.plotting._core.SeriesPlotMethods |
| pop(item) | 返回项目并从框架中删除。 |
| pow(other[, level, fill_value, axis]) | 系列和其他元素的指数幂(二元运算符pow)。 |
| prod([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的乘积 |
| product([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的乘积 |
| ptp([axis, skipna, level, numeric_only]) | 返回最大值和之间的差值 |
| put(*args, **kwargs) | 将put方法应用于其values属性(如果有)。 |
| quantile([q, interpolation]) | 给定分位数处的返回值,即la numpy.percentile。 |
| radd(other[, level, fill_value, axis]) | 添加系列和其他元素(二元运算符radd)。 |
| rank([axis, method, numeric_only, …]) | 沿轴计算数值数据等级(1到n)。 |
| ravel([order]) | 将展平的底层数据作为ndarray返回 |
| rdiv(other[, level, fill_value, axis]) | 系列和其他的浮动划分,元素方式(二元算子rtruediv)。 |
| reindex([index]) | 使用可选填充逻辑将系列符合到新索引,将NA / NaN放置在先前索引中没有值的位置。 |
| reindex_axis(labels[, axis]) | (已弃用)使用可选的填充逻辑将系列符合到新索引。 |
| reindex_like(other[, method, copy, limit, …]) | 将具有匹配索引的对象返回给我自己。 |
| rename([index]) | 更改系列索引标签或名称 |
| rename_axis(mapper[, axis, copy, inplace]) | 更改索引或列的名称。 |
| reorder_levels(order) | 使用输入顺序重新排列索引级别。 |
| repeat(repeats, *args, **kwargs) | 重复系列的元素。 |
| replace([to_replace, value, inplace, limit, …]) | 替换给定的值to_replace与价值。 |
| resample(rule[, how, axis, fill_method, …]) | 频率转换和时间序列重采样的便捷方法。 |
| reset_index([level, drop, name, inplace]) | 使用索引重置生成新的DataFrame或Series。 |
| rfloordiv(other[, level, fill_value, axis]) | 系列和其他的整数除法,元素方式(二元运算符rfloordiv)。 |
| rmod(other[, level, fill_value, axis]) | 系列和其他的模数,元素方式(二元运算符rmod)。 |
| rmul(other[, level, fill_value, axis]) | 系列和其他的乘法,元素(二元运算符rmul)。 |
| rolling(window[, min_periods, center, …]) | 提供滚动窗口计算。 |
| round([decimals]) | 将系列中的每个值舍入到给定的小数位数。 |
| rpow(other[, level, fill_value, axis]) | 系列和其他元素的指数幂(二元运算符rpow)。 |
| rsub(other[, level, fill_value, axis]) | 减去序列和其他元素(二元运算符rsub)。 |
| rtruediv(other[, level, fill_value, axis]) | 系列和其他的浮动划分,元素方式(二元算子rtruediv)。 |
| sample([n, frac, replace, weights, …]) | 从对象轴返回随机的项目样本。 |
| searchsorted(value[, side, sorter]) | 查找应插入元素以维护顺序的索引。 |
| select(crit[, axis]) | (DEPRECATED)返回与轴标签匹配条件对应的数据 |
| sem([axis, skipna, level, ddof, numeric_only]) | 在请求的轴上返回均值的无偏标准误差。 |
| set_axis(labels[, axis, inplace]) | 将所需索引分配给给定轴。 |
| set_value(label, value[, takeable]) | (DEPRECATED)在传递的标签上快速设置单个值。 |
| shift([periods, freq, axis]) | 使用可选的时间频率按期望的周期数移动索引 |
| skew([axis, skipna, level, numeric_only]) | 返回请求轴的无偏偏差,由N-1归一化 |
| slice_shift([periods, axis]) | 相当于移位而不复制数据。 |
| sort_index([axis, level, ascending, …]) | 按索引标签排序系列。 |
| sort_values([axis, ascending, inplace, …]) | 按值排序。 |
| sortlevel([level, ascending, sort_remaining]) | (已弃用)按所选级别对MultiIndex排序系列。 |
| squeeze([axis]) | 挤压长度1维。 |
| std([axis, skipna, level, ddof, numeric_only]) | 返回请求轴上的样本标准偏差。 |
| str | 别名 pandas.core.strings.StringMethods |
| sub(other[, level, fill_value, axis]) | 减去序列和其他元素(二元运算符子)。 |
| subtract(other[, level, fill_value, axis]) | 减去序列和其他元素(二元运算符子)。 |
| sum([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的总和 |
| swapaxes(axis1, axis2[, copy]) | 交换轴和交换值轴适当 |
| swaplevel([i, j, copy]) | 在MultiIndex中交换i和j级别 |
| tail([n]) | 返回最后n行。 |
| take(indices[, axis, convert, is_copy]) | 沿轴返回给定位置索引中的元素。 |
| to_clipboard([excel, sep]) | 将对象复制到系统剪贴板。 |
| to_csv([path, index, sep, na_rep, …]) | 将Series写入逗号分隔值(csv)文件 |
| to_dense() | 返回NDFrame的密集表示(与稀疏相反) |
| to_dict([into]) | 将Series转换为{label - > value} dict或dict-like对象。 |
| to_excel(excel_writer[, sheet_name, na_rep, …]) | 将系列写入Excel工作表 |
| to_frame([name]) | 将Series转换为DataFrame |
| to_hdf(path_or_buf, key, **kwargs) | 使用HDFStore将包含的数据写入HDF5文件。 |
| to_json([path_or_buf, orient, date_format, …]) | 将对象转换为JSON字符串。 |
| to_latex([buf, columns, col_space, header, …]) | 将对象渲染到表格环境表。 |
| to_msgpack([path_or_buf, encoding]) | msgpack(序列化)对象输入文件路径 |
| to_period([freq, copy]) | 将Series从DatetimeIndex转换为具有所需频率的PeriodIndex(如果未传递,则从索引推断) |
| to_pickle(path[, compression, protocol]) | Pickle(序列化)对象到文件。 |
| to_sparse([kind, fill_value]) | 将Series转换为SparseSeries |
| to_sql(name, con[, schema, if_exists, …]) | 将存储在DataFrame中的记录写入SQL数据库。 |
| to_string([buf, na_rep, float_format, …]) | 渲染系列的字符串表示形式 |
| to_timestamp([freq, how, copy]) | 在期间开始时转换为时间戳的datetimedex |
| to_xarray() | 从pandas对象返回一个xarray对象。 |
| tolist() | 返回值列表。 |
| transform(func, *args, **kwargs) | 调用函数生成类似索引的NDFrame并返回带有转换值的NDFrame |
| transpose(*args, **kwargs) | 返回转置,根据定义自我 |
| truediv(other[, 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, ambiguous]) | 将tz-naive TimeSeries本地化为目标时区。 |
| unique() | 返回Series对象的唯一值。 |
| unstack([level, fill_value]) | Unstack,又名 |
| update(other) | 使用传递的Series中的非NA值修改系列。 |
| valid([inplace]) | (DEPRECATED)返回没有空值的系列。 |
| value_counts([normalize, sort, ascending, …]) | 返回包含唯一值计数的对象。 |
| var([axis, skipna, level, ddof, numeric_only]) | 在请求的轴上返回无偏差异。 |
| view([dtype]) | 创建系列的新视图。 |
| where(cond[, other, inplace, axis, level, …]) | 返回与self相同形状的对象,其对应的条目来自self,其中cond为True,否则来自其他。 |
| xs(key[, axis, level, drop_level]) | 返回Series / DataFrame的横截面(行或列)。 |
pandas.DataFrame
class pandas.DataFrame(data = None,index = None,columns = None,dtype = None,copy = False )
具有标记轴(行和列)的二维大小可变,可能异构的表格数据结构。算术运算在行标签和列标签上对齐。可以被认为是Series对象的类似dict的容器。主要的熊猫数据结构。
| 参数: | 数据:numpy ndarray(结构化或同类),dict或DataFrame
index:索引或类似数组
列:索引或类似数组
dtype:dtype,默认无
copy:boolean,默认为False
|
|---|
属性
T | 转置索引和列。 |
at | 访问行/列标签对的单个值。 |
axes | 返回表示DataFrame轴的列表。 |
blocks | (已弃用)as_blocks()的内部属性,属性同义词 |
columns | DataFrame的列标签。 |
dtypes | 返回DataFrame中的dtypes。 |
empty | 指示DataFrame是否为空。 |
ftypes | 返回DataFrame中的ftypes(稀疏/密集和dtype的指示)。 |
iat | 按整数位置访问行/列对的单个值。 |
iloc | 纯粹基于整数位置的索引,用于按位置选择。 |
index | DataFrame的索引(行标签)。 |
ix | 主要基于标签位置的索引器,具有整数位置回退。 |
loc | 通过标签或布尔数组访问一组行和列。 |
ndim | 返回表示轴/数组维数的int。 |
shape | 返回表示DataFrame维度的元组。 |
size | 返回一个int,表示此对象中的元素数。 |
style | 返回Styler对象的属性,该对象包含用于为DataFrame构建样式化HTML表示的方法。 |
values | 返回DataFrame的Numpy表示。 |
方法
| abs() | 返回具有每个元素的绝对数值的Series / DataFrame。 |
| add(other[, axis, level, fill_value]) | 添加数据帧和其他元素(二元运算符添加)。 |
| add_prefix(prefix) | 带有字符串前缀的前缀标签。 |
| add_suffix(suffix) | 带有字符串后缀的后缀标签。 |
| agg(func[, axis]) | 使用指定轴上的一个或多个操作进行聚合。 |
| aggregate(func[, axis]) | 使用指定轴上的一个或多个操作进行聚合。 |
| align(other[, join, axis, level, copy, …]) | 使用指定的每个轴索引的连接方法将轴上的两个对象对齐 |
| all([axis, bool_only, skipna, level]) | 返回是否所有元素都是True,可能是在轴上。 |
| any([axis, bool_only, skipna, level]) | 返回任何元素在请求的轴上是否为True。 |
| append(other[, ignore_index, …]) | 将其他行附加到此帧的末尾,返回一个新对象。 |
| apply(func[, axis, broadcast, raw, reduce, …]) | 沿DataFrame的轴应用函数。 |
| applymap(func) | 将函数元素应用于Dataframe。 |
| as_blocks([copy]) | (已弃用)将帧转换为dtype - >构造函数类型的dict,每个类型都具有同类dtype。 |
| as_matrix([columns]) | (DEPRECATED)将帧转换为Numpy数组表示。 |
| asfreq(freq[, method, how, normalize, …]) | 将TimeSeries转换为指定的频率。 |
| asof(where[, subset]) | 获取没有任何NaN的最后一行(或者在没有NaN的情况下考虑仅使用DataFrame情况下的列子集的最后一行) |
| assign(**kwargs) | 将新列分配给DataFrame,返回一个新对象(副本),并将新列添加到原始列中。 |
| astype(dtype[, copy, errors]) | 将pandas对象转换为指定的dtype dtype。 |
| at_time(time[, asof]) | 在特定时间选择值(例如, |
| between_time(start_time, end_time[, …]) | 选择一天中特定时间之间的值(例如,上午9:00-9:30)。 |
| bfill([axis, inplace, limit, downcast]) | 同义词 DataFrame.fillna(method='bfill') |
| bool() | 返回单个元素PandasObject的bool。 |
| boxplot([column, by, ax, fontsize, rot, …]) | 从DataFrame列创建一个箱形图。 |
| clip([lower, upper, axis, inplace]) | 在输入阈值处修剪值。 |
| clip_lower(threshold[, axis, inplace]) | 返回值低于阈值截断的输入的副本。 |
| clip_upper(threshold[, axis, inplace]) | 输入的返回副本,其值超过给定值(截断)。 |
| combine(other, func[, fill_value, overwrite]) | 添加两个DataFrame对象并且不传播NaN值,因此如果对于(列,时间)一个帧缺少值,它将默认为另一个帧的值(也可能是NaN) |
| combine_first(other) | 将两个DataFrame对象组合在一起,默认为调用该方法的帧中的非空值。 |
| compound([axis, skipna, level]) | 返回请求轴的值的复合百分比 |
| consolidate([inplace]) | (已弃用)使用“合并”内部构件计算NDFrame(每个dtype的数据在单个ndarray中组合在一起)。 |
| convert_objects([convert_dates, …]) | (DEPRECATED)尝试推断对象列的更好dtype。 |
| copy([deep]) | 复制此对象的索引和数据。 |
| corr([method, min_periods]) | 计算列的成对相关性,不包括NA / null值 |
| corrwith(other[, axis, drop]) | 计算两个DataFrame对象的行或列之间的成对关联。 |
| count([axis, level, numeric_only]) | 计算每列或每行的非NA单元格。 |
| cov([min_periods]) | 计算列的成对协方差,不包括NA / null值。 |
| cummax([axis, skipna]) | 返回DataFrame或Series轴上的累积最大值。 |
| cummin([axis, skipna]) | 返回DataFrame或Series轴上的累积最小值。 |
| cumprod([axis, skipna]) | 通过DataFrame或Series轴返回累积产品。 |
| cumsum([axis, skipna]) | 返回DataFrame或Series轴上的累积和。 |
| describe([percentiles, include, exclude]) | 生成描述性统计数据,总结数据集分布的集中趋势,分散和形状,不包括NaN值。 |
| diff([periods, axis]) | 第一个离散的元素差异。 |
| div(other[, axis, level, fill_value]) | 浮动划分数据帧和其他元素(二元运算符truediv)。 |
| divide(other[, axis, level, fill_value]) | 浮动划分数据帧和其他元素(二元运算符truediv)。 |
| dot(other) | 矩阵乘法与DataFrame或Series对象。 |
| drop([labels, axis, index, columns, level, …]) | 从行或列中删除指定的标签。 |
| drop_duplicates([subset, keep, inplace]) | 返回删除了重复行的DataFrame,可选择仅考虑某些列 |
| dropna([axis, how, thresh, subset, inplace]) | 删除缺失的值。 |
| duplicated([subset, keep]) | 返回boolean Series表示重复行,可选择仅考虑某些列 |
| eq(other[, axis, level]) | 用于灵活比较方法的包装器eq |
| equals(other) | 确定两个NDFrame对象是否包含相同的元素。 |
| eval(expr[, inplace]) | 评估描述DataFrame列上的操作的字符串。 |
| ewm([com, span, halflife, alpha, …]) | 提供指数加权函数 |
| expanding([min_periods, center, axis]) | 提供扩展转换。 |
| ffill([axis, inplace, limit, downcast]) | 同义词 DataFrame.fillna(method='ffill') |
| fillna([value, method, axis, inplace, …]) | 使用指定的方法填充NA / NaN值 |
| filter([items, like, regex, axis]) | 根据指定索引中的标签设置数据框的行或列。 |
| first(offset) | 用于基于日期偏移量化时间序列数据的初始时段的便捷方法。 |
| first_valid_index() | 返回第一个非NA / null值的索引。 |
| floordiv(other[, axis, level, fill_value]) | 数据帧和其他元素的整数划分(二元运算符floordiv)。 |
| from_csv(path[, header, sep, index_col, …]) | (已弃用)读取CSV文件。 |
| from_dict(data[, orient, dtype, columns]) | 从类似数组或dicts的dict构造DataFrame。 |
| from_items(items[, columns, orient]) | (DEPRECATED)从元组列表构造数据框 |
| from_records(data[, index, exclude, …]) | 将结构化或记录ndarray转换为DataFrame |
| ge(other[, axis, level]) | 包装用于灵活的比较方法ge |
| get(key[, default]) | 从给定键的对象获取项目(DataFrame列,Panel切片等)。 |
| get_dtype_counts() | 返回此对象中唯一dtypes的计数。 |
| get_ftype_counts() | (DEPRECATED)返回此对象中唯一ftypes的计数。 |
| get_value(index, col[, takeable]) | (DEPRECATED)在传递的列和索引处快速检索单个值 |
| get_values() | 将稀疏值转换为密集后返回一个ndarray。 |
| groupby([by, axis, level, as_index, sort, …]) | 使用mapper(dict或key函数,将给定函数应用于组,将结果作为系列返回)或通过一系列列的组系列。 |
| gt(other[, axis, level]) | 用于灵活比较方法的包装器gt |
| head([n]) | 返回前n行。 |
| hist([column, by, grid, xlabelsize, xrot, …]) | 制作DataFrame的直方图。 |
| idxmax([axis, skipna]) | 返回请求轴上第一次出现最大值的索引。 |
| idxmin([axis, skipna]) | 返回首次出现最小请求轴的索引。 |
| infer_objects() | 尝试推断对象列的更好的dtypes。 |
| info([verbose, buf, max_cols, memory_usage, …]) | 打印DataFrame的简明摘要。 |
| insert(loc, column, value[, allow_duplicates]) | 将列插入指定位置的DataFrame。 |
| interpolate([method, axis, limit, inplace, …]) | 根据不同的方法插值。 |
| isin(values) | 返回boolean DataFrame,显示DataFrame中的每个元素是否包含在值中。 |
| isna() | 检测缺失值。 |
| isnull() | 检测缺失值。 |
| items() | 迭代器(列名,系列)对。 |
| iteritems() | 迭代器(列名,系列)对。 |
| iterrows() | 将DataFrame行迭代为(index,Series)对。 |
| itertuples([index, name]) | 将DataFrame行作为namedtuples迭代,索引值作为元组的第一个元素。 |
| join(other[, on, how, lsuffix, rsuffix, sort]) | 在索引或键列上与其他DataFrame连接列。 |
| keys() | 获取“信息轴”(请参阅索引了解更多信息) |
| kurt([axis, skipna, level, numeric_only]) | 使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。 |
| kurtosis([axis, skipna, level, numeric_only]) | 使用Fisher对峰度的定义(正常峰度== 0.0),在请求轴上返回无偏峰度。 |
| last(offset) | 用于基于日期偏移量化时间序列数据的最终时段的便捷方法。 |
| last_valid_index() | 返回最后一个非NA / null值的索引。 |
| le(other[, axis, level]) | 用于灵活比较方法的包装器 |
| lookup(row_labels, col_labels) | DataFrame的基于标签的“花式索引”功能。 |
| lt(other[, axis, level]) | 用于灵活比较方法的包装器 |
| mad([axis, skipna, level]) | 返回请求轴的值的平均绝对偏差 |
| mask(cond[, other, inplace, axis, level, …]) | 返回与self相同形状的对象,其对应的条目来自self,其中cond为False,否则来自other。 |
| max([axis, skipna, level, numeric_only]) | 此方法返回对象中的最大值。 |
| mean([axis, skipna, level, numeric_only]) | 返回请求轴的值的平均值 |
| median([axis, skipna, level, numeric_only]) | 返回请求轴的值的中值 |
| melt([id_vars, value_vars, var_name, …]) | “Unpivots”DataFrame从宽格式到长格式,可选择设置标识符变量。 |
| memory_usage([index, deep]) | 以字节为单位返回每列的内存使用情况。 |
| merge(right[, how, on, left_on, right_on, …]) | 通过按列或索引执行数据库样式的连接操作来合并DataFrame对象。 |
| min([axis, skipna, level, numeric_only]) | 此方法返回对象中的最小值。 |
| mod(other[, axis, level, fill_value]) | 数据帧的模数和其他元素(二元运算符mod)。 |
| mode([axis, numeric_only]) | 获取沿所选轴的每个元素的模式。 |
| mul(other[, axis, level, fill_value]) | 数据帧和其他元素的乘法(二元运算符mul)。 |
| multiply(other[, axis, level, fill_value]) | 数据帧和其他元素的乘法(二元运算符mul)。 |
| ne(other[, axis, level]) | 用于灵活比较方法的包装器 |
| nlargest(n, columns[, keep]) | 返回第一个ñ通过有序的行列按降序排列。 |
| notna() | 检测现有(非缺失)值。 |
| notnull() | 检测现有(非缺失)值。 |
| nsmallest(n, columns[, keep]) | 获取按n个最小列值排序的DataFrame行。 |
| nunique([axis, dropna]) | 返回具有所请求轴上的不同观察数的系列。 |
| pct_change([periods, fill_method, limit, freq]) | 当前元素和先前元素之间的百分比变化。 |
| pipe(func, *args, **kwargs) | 应用func(self,* args,** kwargs) |
| pivot([index, columns, values]) | 返回由给定索引/列值组织的重新整形的DataFrame。 |
| pivot_table([values, index, columns, …]) | 创建一个电子表格样式的数据透视表作为DataFrame。 |
| plot | 别名 pandas.plotting._core.FramePlotMethods |
| pop(item) | 返回项目并从框架中删除。 |
| pow(other[, axis, level, fill_value]) | 数据帧和其他元素的指数幂(二元运算符pow)。 |
| prod([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的乘积 |
| product([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的乘积 |
| quantile([q, axis, numeric_only, interpolation]) | 在请求的轴上返回给定分位数的值,即la numpy.percentile。 |
| query(expr[, inplace]) | 使用布尔表达式查询帧的列。 |
| radd(other[, axis, level, fill_value]) | 添加数据帧和其他元素(二元运算符radd)。 |
| rank([axis, method, numeric_only, …]) | 沿轴计算数值数据等级(1到n)。 |
| rdiv(other[, axis, level, fill_value]) | 数据帧和其他元素的浮动划分(二元运算符rtruediv)。 |
| reindex([labels, index, columns, axis, …]) | 使用可选填充逻辑将DataFrame符合到新索引,将NA / NaN放置在先前索引中没有值的位置。 |
| reindex_axis(labels[, axis, method, level, …]) | 使用可选的填充逻辑将输入对象符合到新索引,将NA / NaN放置在先前索引中没有值的位置。 |
| reindex_like(other[, method, copy, limit, …]) | 将具有匹配索引的对象返回给我自己。 |
| rename([mapper, index, columns, axis, copy, …]) | 更改轴标签。 |
| rename_axis(mapper[, axis, copy, inplace]) | 更改索引或列的名称。 |
| reorder_levels(order[, axis]) | 使用输入顺序重新排列索引级别。 |
| replace([to_replace, value, inplace, limit, …]) | 替换给定的值to_replace与价值。 |
| resample(rule[, how, axis, fill_method, …]) | 频率转换和时间序列重采样的便捷方法。 |
| reset_index([level, drop, inplace, …]) | 对于具有多级索引的DataFrame,在索引名称下的列中返回带有标签信息的新DataFrame,默认为“level_0”,“level_1”等。 |
| rfloordiv(other[, axis, level, fill_value]) | 数据帧和其他元素的整数划分(二元运算符rfloordiv)。 |
| rmod(other[, axis, level, fill_value]) | 数据帧的模数和其他元素(二元运算符rmod)。 |
| rmul(other[, axis, level, fill_value]) | 数据帧和其他元素的乘法(二元运算符rmul)。 |
| rolling(window[, min_periods, center, …]) | 提供滚动窗口计算。 |
| round([decimals]) | 将DataFrame舍入到可变数量的小数位。 |
| rpow(other[, axis, level, fill_value]) | 数据帧和其他元素的指数幂(二元运算符rpow)。 |
| rsub(other[, axis, level, fill_value]) | 减去数据帧和其他元素(二元运算符rsub)。 |
| rtruediv(other[, axis, level, fill_value]) | 数据帧和其他元素的浮动划分(二元运算符rtruediv)。 |
| sample([n, frac, replace, weights, …]) | 从对象轴返回随机的项目样本。 |
| select(crit[, axis]) | (DEPRECATED)返回与轴标签匹配条件对应的数据 |
| select_dtypes([include, exclude]) | 根据列dtypes返回DataFrame列的子集。 |
| sem([axis, skipna, level, ddof, numeric_only]) | 在请求的轴上返回均值的无偏标准误差。 |
| set_axis(labels[, axis, inplace]) | 将所需索引分配给给定轴。 |
| set_index(keys[, drop, append, inplace, …]) | 使用一个或多个现有列设置DataFrame索引(行标签)。 |
| set_value(index, col, value[, takeable]) | (DEPRECATED)将单个值放在已传递的列和索引处 |
| shift([periods, freq, axis]) | 使用可选的时间频率按期望的周期数移动索引 |
| skew([axis, skipna, level, numeric_only]) | 返回请求轴的无偏偏差,由N-1归一化 |
| slice_shift([periods, axis]) | 相当于移位而不复制数据。 |
| sort_index([axis, level, ascending, …]) | 按标签排序对象(沿轴) |
| sort_values(by[, axis, ascending, inplace, …]) | 按任一轴的值排序 |
| sortlevel([level, axis, ascending, inplace, …]) | (DEPRECATED)按选定的轴和主要级别对多级索引进行排序。 |
| squeeze([axis]) | 挤压长度1维。 |
| stack([level, dropna]) | 将指定级别从列堆叠到索引。 |
| std([axis, skipna, level, ddof, numeric_only]) | 返回请求轴上的样本标准偏差。 |
| sub(other[, axis, level, fill_value]) | 减去数据帧和其他元素(二元运算符子)。 |
| subtract(other[, axis, level, fill_value]) | 减去数据帧和其他元素(二元运算符子)。 |
| sum([axis, skipna, level, numeric_only, …]) | 返回请求轴的值的总和 |
| swapaxes(axis1, axis2[, copy]) | 交换轴和交换值轴适当 |
| swaplevel([i, j, axis]) | 在特定轴上的MultiIndex中交换i和j级别 |
| tail([n]) | 返回最后n行。 |
| take(indices[, axis, convert, is_copy]) | 沿轴返回给定位置索引中的元素。 |
| to_clipboard([excel, sep]) | 将对象复制到系统剪贴板。 |
| to_csv([path_or_buf, sep, na_rep, …]) | 将DataFrame写入逗号分隔值(csv)文件 |
| to_dense() | 返回NDFrame的密集表示(与稀疏相反) |
| to_dict([orient, into]) | 将DataFrame转换为字典。 |
| to_excel(excel_writer[, sheet_name, na_rep, …]) | 将DataFrame写入Excel工作表 |
| to_feather(fname) | 写出DataFrames的二进制羽毛格式 |
| to_gbq(destination_table, project_id[, …]) | 将DataFrame写入Google BigQuery表。 |
| to_hdf(path_or_buf, key, **kwargs) | 使用HDFStore将包含的数据写入HDF5文件。 |
| to_html([buf, columns, col_space, header, …]) | 将DataFrame呈现为HTML表格。 |
| to_json([path_or_buf, orient, date_format, …]) | 将对象转换为JSON字符串。 |
| to_latex([buf, columns, col_space, header, …]) | 将对象渲染到表格环境表。 |
| to_msgpack([path_or_buf, encoding]) | msgpack(序列化)对象输入文件路径 |
| to_panel() | (DEPRECATED)将长(堆叠)格式(DataFrame)转换为宽(3D,Panel)格式。 |
| to_parquet(fname[, engine, compression]) | 将DataFrame写入二进制镶木地板格式。 |
| to_period([freq, axis, copy]) | 使用所需频率将DataFrame从DatetimeIndex转换为PeriodIndex(如果未传递,则从索引推断) |
| to_pickle(path[, compression, protocol]) | Pickle(序列化)对象到文件。 |
| to_records([index, convert_datetime64]) | 将DataFrame转换为NumPy记录数组。 |
| to_sparse([fill_value, kind]) | 转换为SparseDataFrame |
| to_sql(name, con[, schema, if_exists, …]) | 将存储在DataFrame中的记录写入SQL数据库。 |
| to_stata(fname[, convert_dates, …]) | 导出Stata二进制dta文件。 |
| to_string([buf, columns, col_space, header, …]) | 将DataFrame渲染为控制台友好的表格输出。 |
| to_timestamp([freq, how, axis, copy]) | 在期间开始时转换为时间戳的DatetimeIndex |
| to_xarray() | 从pandas对象返回一个xarray对象。 |
| transform(func, *args, **kwargs) | 调用函数生成类似索引的NDFrame并返回带有转换值的NDFrame |
| transpose(*args, **kwargs) | 转置索引和列。 |
| truediv(other[, axis, level, fill_value]) | 浮动划分数据帧和其他元素(二元运算符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, ambiguous]) | 将tz-naive TimeSeries本地化为目标时区。 |
| unstack([level, fill_value]) | 透视(必要的分层)索引标签的级别,返回具有新级别列标签的DataFrame,其最内层级别由透视索引标签组成。 |
| update(other[, join, overwrite, …]) | 使用另一个DataFrame中的非NA值进行就地修改。 |
| var([axis, skipna, level, ddof, numeric_only]) | 在请求的轴上返回无偏差异。 |
| where(cond[, other, inplace, axis, level, …]) | 返回与self相同形状的对象,其对应的条目来自self,其中cond为True,否则来自其他。 |
| xs(key[, axis, level, drop_level]) | 返回Series / DataFrame的横截面(行或列)。 |
8798

被折叠的 条评论
为什么被折叠?



