當前位置: 首頁>>代碼示例>>Python>>正文


Python DataFrame.boxplot方法代碼示例

本文整理匯總了Python中pandas.DataFrame.boxplot方法的典型用法代碼示例。如果您正苦於以下問題:Python DataFrame.boxplot方法的具體用法?Python DataFrame.boxplot怎麽用?Python DataFrame.boxplot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.DataFrame的用法示例。


在下文中一共展示了DataFrame.boxplot方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _plot

# 需要導入模塊: from pandas import DataFrame [as 別名]
# 或者: from pandas.DataFrame import boxplot [as 別名]
def _plot(cls, ax, y, column_num=None, return_type='axes', **kwds):
        if y.ndim == 2:
            y = [remove_na_arraylike(v) for v in y]
            # Boxplot fails with empty arrays, so need to add a NaN
            #   if any cols are empty
            # GH 8181
            y = [v if v.size > 0 else np.array([np.nan]) for v in y]
        else:
            y = remove_na_arraylike(y)
        bp = ax.boxplot(y, **kwds)

        if return_type == 'dict':
            return bp, bp
        elif return_type == 'both':
            return cls.BP(ax=ax, lines=bp), bp
        else:
            return ax, bp 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:19,代碼來源:_core.py

示例2: boxplot_frame

# 需要導入模塊: from pandas import DataFrame [as 別名]
# 或者: from pandas.DataFrame import boxplot [as 別名]
def boxplot_frame(self, column=None, by=None, ax=None, fontsize=None, rot=0,
                  grid=True, figsize=None, layout=None,
                  return_type=None, **kwds):
    import matplotlib.pyplot as plt
    _converter._WARN = False
    ax = boxplot(self, column=column, by=by, ax=ax, fontsize=fontsize,
                 grid=grid, rot=rot, figsize=figsize, layout=layout,
                 return_type=return_type, **kwds)
    plt.draw_if_interactive()
    return ax 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:12,代碼來源:_core.py

示例3: boxplot_frame

# 需要導入模塊: from pandas import DataFrame [as 別名]
# 或者: from pandas.DataFrame import boxplot [as 別名]
def boxplot_frame(self, column=None, by=None, ax=None, fontsize=None, rot=0,
                  grid=True, figsize=None, layout=None,
                  return_type=None, **kwds):
    import matplotlib.pyplot as plt
    _setup()
    ax = boxplot(self, column=column, by=by, ax=ax, fontsize=fontsize,
                 grid=grid, rot=rot, figsize=figsize, layout=layout,
                 return_type=return_type, **kwds)
    plt.draw_if_interactive()
    return ax 
開發者ID:securityclippy,項目名稱:elasticintel,代碼行數:12,代碼來源:_core.py

示例4: box

# 需要導入模塊: from pandas import DataFrame [as 別名]
# 或者: from pandas.DataFrame import boxplot [as 別名]
def box(self, by=None, **kwds):
        r"""
        Make a box plot of the DataFrame columns.

        A box plot is a method for graphically depicting groups of numerical
        data through their quartiles.
        The box extends from the Q1 to Q3 quartile values of the data,
        with a line at the median (Q2). The whiskers extend from the edges
        of box to show the range of the data. The position of the whiskers
        is set by default to 1.5*IQR (IQR = Q3 - Q1) from the edges of the
        box. Outlier points are those past the end of the whiskers.

        For further details see Wikipedia's
        entry for `boxplot <https://en.wikipedia.org/wiki/Box_plot>`__.

        A consideration when using this chart is that the box and the whiskers
        can overlap, which is very common when plotting small sets of data.

        Parameters
        ----------
        by : string or sequence
            Column in the DataFrame to group by.
        **kwds : optional
            Additional keywords are documented in
            :meth:`pandas.DataFrame.plot`.

        Returns
        -------
        axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them

        See Also
        --------
        pandas.DataFrame.boxplot: Another method to draw a box plot.
        pandas.Series.plot.box: Draw a box plot from a Series object.
        matplotlib.pyplot.boxplot: Draw a box plot in matplotlib.

        Examples
        --------
        Draw a box plot from a DataFrame with four columns of randomly
        generated data.

        .. plot::
            :context: close-figs

            >>> data = np.random.randn(25, 4)
            >>> df = pd.DataFrame(data, columns=list('ABCD'))
            >>> ax = df.plot.box()
        """
        return self(kind='box', by=by, **kwds) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:51,代碼來源:_core.py


注:本文中的pandas.DataFrame.boxplot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。