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()
andT
return the same result. Whiletranspose()
is more verbose and easy to understand, data practitioners often useT
because of its brevity.
Get hands-on with 1400+ tech skills courses.