Skip to main content

__ Back to top

__ ` Ctrl ` \+ ` K `

[ ![pandas 2.2.2 documentation - Home](../../_static/pandas.svg)
](../../index.html)

Site Navigation

  * [ Getting started ](../../getting_started/index.html)
  * [ User Guide ](../../user_guide/index.html)
  * [ API reference ](../index.html)
  * [ Development ](../../development/index.html)
  * [ Release notes ](../../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

Site Navigation

  * [ Getting started ](../../getting_started/index.html)
  * [ User Guide ](../../user_guide/index.html)
  * [ API reference ](../index.html)
  * [ Development ](../../development/index.html)
  * [ Release notes ](../../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

  * [ Input/output ](../io.html)
  * [ General functions ](../general_functions.html) __
    * [ pandas.melt ](pandas.melt.html)
    * pandas.pivot 
    * [ pandas.pivot_table ](pandas.pivot_table.html)
    * [ pandas.crosstab ](pandas.crosstab.html)
    * [ pandas.cut ](pandas.cut.html)
    * [ pandas.qcut ](pandas.qcut.html)
    * [ pandas.merge ](pandas.merge.html)
    * [ pandas.merge_ordered ](pandas.merge_ordered.html)
    * [ pandas.merge_asof ](pandas.merge_asof.html)
    * [ pandas.concat ](pandas.concat.html)
    * [ pandas.get_dummies ](pandas.get_dummies.html)
    * [ pandas.from_dummies ](pandas.from_dummies.html)
    * [ pandas.factorize ](pandas.factorize.html)
    * [ pandas.unique ](pandas.unique.html)
    * [ pandas.lreshape ](pandas.lreshape.html)
    * [ pandas.wide_to_long ](pandas.wide_to_long.html)
    * [ pandas.isna ](pandas.isna.html)
    * [ pandas.isnull ](pandas.isnull.html)
    * [ pandas.notna ](pandas.notna.html)
    * [ pandas.notnull ](pandas.notnull.html)
    * [ pandas.to_numeric ](pandas.to_numeric.html)
    * [ pandas.to_datetime ](pandas.to_datetime.html)
    * [ pandas.to_timedelta ](pandas.to_timedelta.html)
    * [ pandas.date_range ](pandas.date_range.html)
    * [ pandas.bdate_range ](pandas.bdate_range.html)
    * [ pandas.period_range ](pandas.period_range.html)
    * [ pandas.timedelta_range ](pandas.timedelta_range.html)
    * [ pandas.infer_freq ](pandas.infer_freq.html)
    * [ pandas.interval_range ](pandas.interval_range.html)
    * [ pandas.eval ](pandas.eval.html)
    * [ pandas.tseries.api.guess_datetime_format ](pandas.tseries.api.guess_datetime_format.html)
    * [ pandas.util.hash_array ](pandas.util.hash_array.html)
    * [ pandas.util.hash_pandas_object ](pandas.util.hash_pandas_object.html)
    * [ pandas.api.interchange.from_dataframe ](pandas.api.interchange.from_dataframe.html)
  * [ Series ](../series.html)
  * [ DataFrame ](../frame.html)
  * [ pandas arrays, scalars, and data types ](../arrays.html)
  * [ Index objects ](../indexing.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)
  * [ General functions ](../general_functions.html)
  * pandas.pivot 

#  pandas.pivot  #

pandas.  pivot  (  _ data  _ , _ *  _ , _ columns  _ , _ index  =
_NoDefault.no_default  _ , _ values  =  _NoDefault.no_default  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/reshape/pivot.py#L507-L575) #

    

Return reshaped DataFrame organized by given index / column values.

Reshape data (produce a âpivotâ table) based o