zoukankan      html  css  js  c++  java
  • pandas groupby

    pandas.DataFrame.groupby

    DataFrame.groupby(by=None, axis=0, level=None, as_index=True, sort=True, group_keys=True, squeeze=False, **kwargs)

    Group series using mapper (dict or key function, apply given function to group, return result as series) or by a series of columns.
        Parameters:    

        by : mapping function / list of functions, dict, Series, or tuple /

            list of column names. Called on each element of the object index to determine the groups. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups

        axis : int, default 0

        level : int, level name, or sequence of such, default None

            If the axis is a MultiIndex (hierarchical), group by a particular level or levels

        as_index : boolean, default True

            For aggregated output, return object with group labels as the index. Only relevant for DataFrame input. as_index=False is effectively “SQL-style” grouped output

        sort : boolean, default True

            Sort group keys. Get better performance by turning this off. Note this does not influence the order of observations within each group. groupby preserves the order of rows within each group.

        group_keys : boolean, default True

            When calling apply, add group keys to index to identify pieces

        squeeze : boolean, default False

            reduce the dimensionality of the return type if possible, otherwise return a consistent type

        Returns:    

            GroupBy object


    Examples


    DataFrame results

    >>> data.groupby(func, axis=0).mean()
    >>> data.groupby(['col1', 'col2'])['col3'].mean()



    DataFrame with hierarchical index

    >>> data.groupby(['col1', 'col2']).mean()



  • 相关阅读:
    支持xp风格的manifest
    XPath and TXmlDocument
    TXMLDocument use case (Delphi)
    Delphi中,除了应用程序主窗口会显示在任务栏上,其它窗口默认都不会显示在任务栏.
    Delphi下让窗口不显示在任务栏的另类方法
    拨号、断网、枚举连接名称,判断是否在线、连接方式
    [转]装逼
    这该死的数字化生活
    4根网线水晶头接法(8根只接4根即可通讯)
    关闭Delphi的RTTI
  • 原文地址:https://www.cnblogs.com/hhh5460/p/5596374.html
Copyright © 2011-2022 走看看