zoukankan      html  css  js  c++  java
  • python(一)——pandas

    1、查看帮助文档

    import matplotlib.pyplot as plt
    help(plt.plot)

     2、arr[:,],“:”表示全选每行,“,”后再选取指定的列

    ma = np.array([[1,3,2],[3,4,6],[3,33,6]])
    ma.shape
    print (ma[:,2])
    print (ma[:,1:3])

     3、pandas中的DataFrame基本操作

    构造函数

    方法描述
    DataFrame([data, index, columns, dtype, copy]) 构造数据框

    属性和数据

    方法描述
    Axes index: row labels;columns: column labels
    DataFrame.as_matrix([columns]) 转换为矩阵
    DataFrame.dtypes 返回数据的类型
    DataFrame.ftypes Return the ftypes (indication of sparse/dense and dtype) in this object.
    DataFrame.get_dtype_counts() 返回数据框数据类型的个数
    DataFrame.get_ftype_counts() Return the counts of ftypes in this object.
    DataFrame.select_dtypes([include, exclude]) 根据数据类型选取子数据框
    DataFrame.values Numpy的展示方式
    DataFrame.axes 返回横纵坐标的标签名
    DataFrame.ndim 返回数据框的纬度
    DataFrame.size 返回数据框元素的个数
    DataFrame.shape 返回数据框的形状
    DataFrame.memory_usage([index, deep]) Memory usage of DataFrame columns.

    描述统计学

    方法描述
    DataFrame.abs() 返回绝对值
    DataFrame.all([axis, bool_only, skipna, level]) Return whether all elements are True over requested axis
    DataFrame.any([axis, bool_only, skipna, level]) Return whether any element is True over requested axis
    DataFrame.clip([lower, upper, axis]) Trim values at input threshold(s).
    DataFrame.clip_lower(threshold[, axis]) Return copy of the input with values below given value(s) truncated.
    DataFrame.clip_upper(threshold[, axis]) Return copy of input with values above given value(s) truncated.
    DataFrame.corr([method, min_periods]) 返回本数据框成对列的相关性系数
    DataFrame.corrwith(other[, axis, drop]) 返回不同数据框的相关性
    DataFrame.count([axis, level, numeric_only]) 返回非空元素的个数
    DataFrame.cov([min_periods]) 计算协方差
    DataFrame.cummax([axis, skipna]) Return cumulative max over requested axis.
    DataFrame.cummin([axis, skipna]) Return cumulative minimum over requested axis.
    DataFrame.cumprod([axis, skipna]) 返回累积
    DataFrame.cumsum([axis, skipna]) 返回累和
    DataFrame.describe([percentiles, include, …]) 整体描述数据框
    DataFrame.diff([periods, axis]) 1st discrete difference of object
    DataFrame.eval(expr[, inplace]) Evaluate an expression in the context of the calling DataFrame instance.
    DataFrame.kurt([axis, skipna, level, …]) 返回无偏峰度Fisher’s (kurtosis of normal == 0.0).
    DataFrame.mad([axis, skipna, level]) 返回偏差
    DataFrame.max([axis, skipna, level, …]) 返回最大值
    DataFrame.mean([axis, skipna, level, …]) 返回均值
    DataFrame.median([axis, skipna, level, …]) 返回中位数
    DataFrame.min([axis, skipna, level, …]) 返回最小值
    DataFrame.mode([axis, numeric_only]) 返回众数
    DataFrame.pct_change([periods, fill_method, …]) 返回百分比变化
    DataFrame.prod([axis, skipna, level, …]) 返回连乘积
    DataFrame.quantile([q, axis, numeric_only, …]) 返回分位数
    DataFrame.rank([axis, method, numeric_only, …]) 返回数字的排序
    DataFrame.round([decimals]) Round a DataFrame to a variable number of decimal places.
    DataFrame.sem([axis, skipna, level, ddof, …]) 返回无偏标准误
    DataFrame.skew([axis, skipna, level, …]) 返回无偏偏度
    DataFrame.sum([axis, skipna, level, …]) 求和
    DataFrame.std([axis, skipna, level, ddof, …]) 返回标准误差
    DataFrame.var([axis, skipna, level, ddof, …]) 返回无偏误差

     

  • 相关阅读:
    GIT初探
    IIS7添加虚拟目录映射另一台服务器的共享文件夹
    The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
    asp.net编码解码的两篇文章
    生成网站时提示 已预编译此应用程序
    错误 1 无法将程序集“NBear.Data.dll”复制到文件“D: ewbpmpmSureBpmBinNBear.Data.dll”。无法将“D: ewbpmpmSureSoft.WebServiceBaseLibinDebugNBear.Data.dll”添加到网站。 无法添加文件“BinNBear.Data.dll”。 拒绝访问。 D:..
    从Script到Code Blocks、Code Behind到MVC、MVP、MVVM(转载)
    HTML form表单的默认提交方式
    webapp检测手机运动方向,可实现手机摇一摇功能的触发
    手机/P各种提示框整合,纯js实现,比前端大多数框架的提示消息更好用
  • 原文地址:https://www.cnblogs.com/strong-FE/p/10163615.html
Copyright © 2011-2022 走看看