Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Pandas DataFrame: transpose() function

DataFrame - transpose() function

The transpose() function is used to transpose index and columns.

Reflect the DataFrame over its main diagonal by writing rows as columns and vice-versa.

Syntax:

DataFrame.transpose(self, *args, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
copy           If True, the underlying data is copied. Otherwise (default), no copy is made if possible. bool
Default Value: False
Required
*args, **kwargs Additional keywords have no effect but might be accepted for compatibility with numpy.   Required

Returns: DataFrame
The transposed DataFrame.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - T() function
Next: DataFrame - append() function