pandas.DataFrame.T — pandas 3.0.0rc0+31.g944c527c0a documentation (original) (raw)

property DataFrame.T[source]#

The transpose of the DataFrame.

Returns:

DataFrame

The transposed DataFrame.

Examples

df = pd.DataFrame({"col1": [1, 2], "col2": [3, 4]}) df col1 col2 0 1 3 1 2 4

df.T 0 1 col1 1 2 col2 3 4