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, …]) 返回无偏误差

     

  • 相关阅读:
    1012 The Best Rank (25 分)(排序)
    1011. World Cup Betting (20)(查找元素)
    1009 Product of Polynomials (25 分)(模拟)
    1008 Elevator (20 分)(数学问题)
    1006 Sign In and Sign Out (25 分)(查找元素)
    1005 Spell It Right (20 分)(字符串处理)
    Kafka Connect 出现ERROR Failed to flush WorkerSourceTask{id=local-file-source-0}, timed out while wait
    flume、kafka、avro组成的消息系统
    Java23种设计模式总结【转载】
    Java编程 思维导图
  • 原文地址:https://www.cnblogs.com/strong-FE/p/10163615.html
Copyright © 2011-2022 走看看