Further Reshaping Capabilities

Discover further reshaping and manipulation capabilities of pandas.

Overview

While we've covered the essential pandas functions for reshaping and manipulating data, there are several others that also deserve a mention. These methods may be used less often, but they are still highly useful for our data preparation efforts.

The transpose() method

Transposing a DataFrame means flipping (or rotating) the rows and columns so that the rows become columns and the columns become rows. This operation can be performed with the transpose() or T method.

Note: Both transpose() and T return the same result. While transpose() is more verbose and easy to understand, data practitioners often use T because of its brevity.

Get hands-on with 1200+ tech skills courses.