mteb/BrightProStackoverflowRetrieval huggingface dataset:
dex.from_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.to_frame  #

MultiIndex.  to_frame  (  _ index  =  True  _ , _ name  =
_NoDefault.no_default  _ , _ allow_duplicates  =  False  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L1844-L1932) #

    

Create a DataFrame with the levels of the MultiIndex as columns.

Column ordering is determined by the DataFrame constructor with data as a
dict.

Parameters  :

    

**index** bool, default True

    

Set the index of the returned DataFrame as the original MultiIndex.

**name** list / sequence of str, optional

    

The passed names should substitute index level names.

**allow_duplicates** bool, optional default False

    

Allow duplicate column labels to be created.

New in version 1.5.0.

Returns  :

    

DataFrame

    

See also

[ ` DataFrame  ` ](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")

    

Two-dimensional, size-mutable, potentially heterogeneous tabular data.

Examples

    
    
    >>> mi = pd.MultiIndex.from_arrays([['a', 'b'], ['c', 'd']])
    >>> mi
    MultiIndex([('a', 'c'),
                ('b', 'd')],
               )
    
    
    
    >>> df = mi.to_frame()
    >>> df
         0  1
    a c  a  c
    b d  b  d
    
    
    
    >>> df = mi.to_frame(index=False)
    >>> df
       0  1
    0  a  c
    1  b  d
    
    
    
    >>> df = mi.to_frame(name=['x', 'y'])
    >>> df
         x  y
    a c  a  c
    b d  b  d
    

[ __ previous  pandas.MultiIndex.set_codes  ](pandas.MultiIndex.set_codes.html
"previous page") [ next  pandas.MultiIndex.to_flat_index  __
](pandas.MultiIndex.to_flat_index.html "next page")

__ On this page

  * ` MultiIndex.to_frame()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.to_frame.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_numpy  #

DataFrame.  to_numpy  (  _ dtype  =  None  _ , _ copy  =  False  _ , _
na_value  =  _NoDefault.no_default  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L1933-L1997) #

    

Convert the DataFrame to a NumPy array.

By default, the dtype of the returned array will be the common NumPy dtype of
all types in the DataFrame. For example, if the dtypes are ` float16  ` and `
float32  ` , the results dtype will be ` float32  ` . This may require copying
data and coercing values, which may be expensive.

Parameters  :

    

**dtype** str or numpy.dtype, optional

    

The dtype to pass to ` numpy.asarray()  ` .

**copy** bool, default False

    

Whether to ensure that the returned value is not a view on another array. Note
that ` copy=False  ` does not _ensure_ that ` to_numpy()  ` is no-copy.
Rather, ` copy=True  ` ensure that a copy is made, even if not strictly
necessary.

**na_value** Any, optional

    

The value to use for missing values. The default value depends on  dtype  and
the dtypes of the DataFrame columns.

Returns  :

    

numpy.ndarray

    

See also

[ ` Series.to_numpy  ` ](pandas.Series.to_numpy.html#pandas.Series.to_numpy
"pandas.Series.to_numpy")

    

Similar method for Series.

Examples

    
    
    >>> pd.DataFrame({"A": [1, 2], "B": [3, 4]}).to_numpy()
    array([[1, 3],
           [2, 4]])
    

With heterogeneous data, the lowest common type will have to be used.

    
    
    >>> df = pd.DataFrame({"A": [1, 2], "B": [3.0, 4.5]})
    >>> df.to_numpy()
    array([[1. , 3. ],
           [2. , 4.5]])
    

For a mix of numeric and non-numeric types, the output array will have object
dtype.

    
    
    >>> df['C'] = pd.date_range('2000', periods=2)
    >>> df.to_numpy()
    array([[1, 3.0, Timestamp('2000-01-01 00:00:00')],
           [2, 4.5, Timestamp('2000-01-02 00:00:00')]], dtype=object)
    

[ __ previous  pandas.DataFrame.bool  ](pandas.DataFrame.bool.html "previous
page") [ next  pandas.DataFrame.head  __ ](pandas.DataFrame.head.html "next
page")

__ On this page

  * ` DataFrame.to_numpy()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.to_numpy.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
m_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.dayofweek  #

_ property  _ PeriodIndex.  dayofweek  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

The day of the week with Monday=0, Sunday=6.

Examples

    
    
    >>> idx = pd.PeriodIndex(["2023-01-01", "2023-01-02", "2023-01-03"], freq="D")
    >>> idx.weekday
    Index([6, 0, 1], dtype='int64')
    

[ __ previous  pandas.PeriodIndex.day  ](pandas.PeriodIndex.day.html "previous
page") [ next  pandas.PeriodIndex.day_of_week  __
](pandas.PeriodIndex.day_of_week.html "next page")

__ On this page

  * ` PeriodIndex.dayofweek  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.dayofweek.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
* [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.last_valid_index  #

DataFrame.  last_valid_index  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L12868-L12871) #

    

Return index for last non-NA value or None, if no non-NA value is found.

Returns  :

    

type of index

    

Examples

For Series:

    
    
    >>> s = pd.Series([None, 3, 4])
    >>> s.first_valid_index()
    1
    >>> s.last_valid_index()
    2
    
    
    
    >>> s = pd.Series([None, None])
    >>> print(s.first_valid_index())
    None
    >>> print(s.last_valid_index())
    None
    

If all elements in Series are NA/null, returns None.

    
    
    >>> s = pd.Series()
    >>> print(s.first_valid_index())
    None
    >>> print(s.last_valid_index())
    None
    

If Series is empty, returns None.

For DataFrame:

    
    
    >>> df = pd.DataFrame({'A': [None, None, 2], 'B': [None, 3, 4]})
    >>> df
         A      B
    0  NaN    NaN
    1  NaN    3.0
    2  2.0    4.0
    >>> df.first_valid_index()
    1
    >>> df.last_valid_index()
    2
    
    
    
    >>> df = pd.DataFrame({'A': [None, None, None], 'B': [None, None, None]})
    >>> df
         A      B
    0  None   None
    1  None   None
    2  None   None
    >>> print(df.first_valid_index())
    None
    >>> print(df.last_valid_index())
    None
    

If all elements in DataFrame are NA/null, returns None.

    
    
    >>> df = pd.DataFrame()
    >>> df
    Empty DataFrame
    Columns: []
    Index: []
    >>> print(df.first_valid_index())
    None
    >>> print(df.last_valid_index())
    None
    

If DataFrame is empty, returns None.

[ __ previous  pandas.DataFrame.first_valid_index
](pandas.DataFrame.first_valid_index.html "previous page") [ next
pandas.DataFrame.resample  __ ](pandas.DataFrame.resample.html "next page")

__ On this page

  * ` DataFrame.last_valid_index()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.last_valid_index.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
pby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.kurt  #

DataFrame.  kurt  (  _ axis  =  0  _ , _ skipna  =  True  _ , _ numeric_only
=  False  _ , _ **  kwargs  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L11766-L11777) #

    

Return unbiased kurtosis over requested axis.

Kurtosis obtained using Fisherâs definition of kurtosis (kurtosis of normal
== 0.0). Normalized by N-1.

Parameters  :

    

**axis** {index (0), columns (1)}

    

Axis for the function to be applied on. For  Series  this parameter is unused
and defaults to 0.

For DataFrames, specifying ` axis=None  ` will apply the aggregation across
both axes.

New in version 2.0.0.

**skipna** bool, default True

    

Exclude NA/null values when computing the result.

**numeric_only** bool, default False

    

Include only float, int, boolean columns. Not implemented for Series.

****kwargs**

    

Additional keyword arguments to be passed to the function.

Returns  :

    

Series or scalar

    

Examples

    
    
    >>> s = pd.Series([1, 2, 2, 3], index=['cat', 'dog', 'dog', 'mouse'])
    >>> s
    cat    1
    dog    2
    dog    2
    mouse  3
    dtype: int64
    >>> s.kurt()
    1.5
    

With a DataFrame

    
    
    >>> df = pd.DataFrame({'a': [1, 2, 2, 3], 'b': [3, 4, 4, 4]},
    ...                   index=['cat', 'dog', 'dog', 'mouse'])
    >>> df
           a   b
      cat  1   3
      dog  2   4
      dog  2   4
    mouse  3   4
    >>> df.kurt()
    a   1.5
    b   4.0
    dtype: float64
    

With axis=None

    
    
    >>> df.kurt(axis=None).round(6)
    -0.988693
    

Using axis=1

    
    
    >>> df = pd.DataFrame({'a': [1, 2], 'b': [3, 4], 'c': [3, 4], 'd': [1, 2]},
    ...                   index=['cat', 'dog'])
    >>> df.kurt(axis=1)
    cat   -6.0
    dog   -6.0
    dtype: float64
    

[ __ previous  pandas.DataFrame.eval  ](pandas.DataFrame.eval.html "previous
page") [ next  pandas.DataFrame.kurtosis  __ ](pandas.DataFrame.kurtosis.html
"next page")

__ On this page

  * ` DataFrame.kurt()  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.kurt.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
* [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.combine_first  #

DataFrame.  combine_first  (  _ other  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L8780-L8859) #

    

Update null elements with value in the same location in  other  .

Combine two DataFrame objects by filling null values in one DataFrame with
non-null values from other DataFrame. The row and column indexes of the
resulting DataFrame will be the union of the two. The resulting dataframe
contains the âfirstâ dataframe values and overrides the second one values
where both first.loc[index, col] and second.loc[index, col] are not missing
values, upon calling first.combine_first(second).

Parameters  :

    

**other** DataFrame

    

Provided DataFrame to use to fill null values.

Returns  :

    

DataFrame

    

The result of combining the provided DataFrame with the other object.

See also

[ ` DataFrame.combine  `
](pandas.DataFrame.combine.html#pandas.DataFrame.combine
"pandas.DataFrame.combine")

    

Perform series-wise operation on two DataFrames using a given function.

Examples

    
    
    >>> df1 = pd.DataFrame({'A': [None, 0], 'B': [None, 4]})
    >>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
    >>> df1.combine_first(df2)
         A    B
    0  1.0  3.0
    1  0.0  4.0
    

Null values still persist if the location of that null value does not exist in
other

    
    
    >>> df1 = pd.DataFrame({'A': [None, 0], 'B': [4, None]})
    >>> df2 = pd.DataFrame({'B': [3, 3], 'C': [1, 1]}, index=[1, 2])
    >>> df1.combine_first(df2)
         A    B    C
    0  NaN  4.0  NaN
    1  0.0  3.0  1.0
    2  NaN  3.0  1.0
    

[ __ previous  pandas.DataFrame.combine  ](pandas.DataFrame.combine.html
"previous page") [ next  pandas.DataFrame.apply  __
](pandas.DataFrame.apply.html "next page")

__ On this page

  * ` DataFrame.combine_first()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.combine_first.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
upby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataFrame.abs 

#  pandas.DataFrame.abs  #

DataFrame.  abs  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L1651-L1722) #

    

Return a Series/DataFrame with absolute numeric value of each element.

This function only applies to elements that are all numeric.

Returns  :

    

abs

    

Series/DataFrame containing the absolute value of each element.

See also

[ ` numpy.absolute  `
](https://numpy.org/doc/stable/reference/generated/numpy.absolute.html#numpy.absolute
"\(in NumPy v1.26\)")

    

Calculate the absolute value element-wise.

Notes

For ` complex  ` inputs, ` 1.2  +  1j  ` , the absolute value is  \\(\sqrt{
a^2 + b^2 }\\)  .

Examples

Absolute numeric values in a Series.

    
    
    >>> s = pd.Series([-1.10, 2, -3.33, 4])
    >>> s.abs()
    0    1.10
    1    2.00
    2    3.33
    3    4.00
    dtype: float64
    

Absolute numeric values in a Series with complex numbers.

    
    
    >>> s = pd.Series([1.2 + 1j])
    >>> s.abs()
    0    1.56205
    dtype: float64
    

Absolute numeric values in a Series with a Timedelta element.

    
    
    >>> s = pd.Series([pd.Timedelta('1 days')])
    >>> s.abs()
    0   1 days
    dtype: timedelta64[ns]
    

Select rows with data closest to certain value using argsort (from [
StackOverflow ](https://stackoverflow.com/a/17758115) ).

    
    
    >>> df = pd.DataFrame({
    ...     'a': [4, 5, 6, 7],
    ...     'b': [10, 20, 30, 40],
    ...     'c': [100, 50, -30, -50]
    ... })
    >>> df
         a    b    c
    0    4   10  100
    1    5   20   50
    2    6   30  -30
    3    7   40  -50
    >>> df.loc[(df.c - 43).abs().argsort()]
         a    b    c
    1    5   20   50
    0    4   10  100
    2    6   30  -30
    3    7   40  -50
    

[ __ previous  pandas.DataFrame.ewm  ](pandas.DataFrame.ewm.html "previous
page") [ next  pandas.DataFrame.all  __ ](pandas.DataFrame.all.html "next
page")

__ On this page

  * ` DataFrame.abs()  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.abs.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
by.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.items  #

DataFrame.  items  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L1496-L1503) #

    

Iterate over (column name, Series) pairs.

Iterates over the DataFrame columns, returning a tuple with the column name
and the content as a Series.

Yields  :

    

**label** object

    

The column names for the DataFrame being iterated over.

**content** Series

    

The column entries belonging to each label, as a Series.

See also

[ ` DataFrame.iterrows  `
](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows
"pandas.DataFrame.iterrows")

    

Iterate over DataFrame rows as (index, Series) pairs.

[ ` DataFrame.itertuples  `
](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples
"pandas.DataFrame.itertuples")

    

Iterate over DataFrame rows as namedtuples of the values.

Examples

    
    
    >>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
    ...                   'population': [1864, 22000, 80000]},
    ...                   index=['panda', 'polar', 'koala'])
    >>> df
            species   population
    panda   bear      1864
    polar   bear      22000
    koala   marsupial 80000
    >>> for label, content in df.items():
    ...     print(f'label: {label}')
    ...     print(f'content: {content}', sep='\n')
    ...
    label: species
    content:
    panda         bear
    polar         bear
    koala    marsupial
    Name: species, dtype: object
    label: population
    content:
    panda     1864
    polar    22000
    koala    80000
    Name: population, dtype: int64
    

[ __ previous  pandas.DataFrame.__iter__  ](pandas.DataFrame.__iter__.html
"previous page") [ next  pandas.DataFrame.keys  __
](pandas.DataFrame.keys.html "next page")

__ On this page

  * ` DataFrame.items()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.items.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.plot.pie  #

DataFrame.plot.  pie  (  _ **  kwargs  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/plotting/_core.py#L1605-L1658) #

    

Generate a pie plot.

A pie plot is a proportional representation of the numerical data in a column.
This function wraps ` matplotlib.pyplot.pie()  ` for the specified column. If
no column reference is passed and ` subplots=True  ` a pie plot is drawn for
each numerical column independently.

Parameters  :

    

**y** int or label, optional

    

Label or position of the column to plot. If not provided, ` subplots=True  `
argument must be passed.

****kwargs**

    

Keyword arguments to pass on to [ ` DataFrame.plot()  `
](pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") .

Returns  :

    

matplotlib.axes.Axes or np.ndarray of them

    

A NumPy array is returned when  subplots  is True.

See also

[ ` Series.plot.pie  ` ](pandas.Series.plot.pie.html#pandas.Series.plot.pie
"pandas.Series.plot.pie")

    

Generate a pie plot for a Series.

[ ` DataFrame.plot  ` ](pandas.DataFrame.plot.html#pandas.DataFrame.plot
"pandas.DataFrame.plot")

    

Make plots of a DataFrame.

Examples

In the example below we have a DataFrame with the information about planetâs
mass and radius. We pass the âmassâ column to the pie function to get a
pie plot.

    
    
    >>> df = pd.DataFrame({'mass': [0.330, 4.87 , 5.97],
    ...                    'radius': [2439.7, 6051.8, 6378.1]},
    ...                   index=['Mercury', 'Venus', 'Earth'])
    >>> plot = df.plot.pie(y='mass', figsize=(5, 5))
    

![../../_images/pandas-DataFrame-plot-pie-1.png](../../_images/pandas-
DataFrame-plot-pie-1.png)

    
    
    >>> plot = df.plot.pie(subplots=True, figsize=(11, 6))
    

![../../_images/pandas-DataFrame-plot-pie-2.png](../../_images/pandas-
DataFrame-plot-pie-2.png)

[ __ previous  pandas.DataFrame.plot.line  ](pandas.DataFrame.plot.line.html
"previous page") [ next  pandas.DataFrame.plot.scatter  __
](pandas.DataFrame.plot.scatter.html "next page")

__ On this page

  * ` DataFrame.plot.pie()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.plot.pie.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.