Hướng dẫn dùng dataframe transpose python

  • Home
  • Python Home
  • ▼Python Pandas Tutorials
  • Pandas Home
  • ▼Pandas DataFrame Constructor
  • Pandas DataFrame Home
  • ▼Pandas DataFrame Reshaping, sorting, transposing
  • DataFrame.droplevel()
  • DataFrame.pivot()
  • DataFrame.pivot_table()
  • DataFrame.sort_values()
  • DataFrame.nlargest()
  • DataFrame.nsmallest()
  • DataFrame.stack()
  • DataFrame.unstack()
  • DataFrame.melt()
  • DataFrame.explode()
  • DataFrame.squeeze()
  • DataFrame.T()
  • DataFrame.transpose()
  • ..More to come..

Last update on August 19 2022 21:50:33 (UTC/GMT +8 hours)

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:

NameDescriptionType/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

  • Exercises: Weekly Top 12 Most Popular Topics
  • Pandas DataFrame: Exercises, Practice, Solution
  • Conversion Tools
  • JavaScript: HTML Form Validation
  • SQL Exercises, Practice, Solution - SUBQUERIES
  • C Programming Exercises, Practice, Solution : For Loop
  • Python Exercises, Practice, Solution
  • Python Data Type: List - Exercises, Practice, Solution
  • C++ Basic: Exercises, Practice, Solution
  • SQL Exercises, Practice, Solution - exercises on Employee Database
  • SQL Exercises, Practice, Solution - exercises on Movie Database
  • SQL Exercises, Practice, Solution - exercises on Soccer Database
  • C Programming Exercises, Practice, Solution : Recursion