Skip to content

Commit 35586f3

Browse files
authored
DOC: Add docstring for DataFrame.T property (#50766)
* Add docstring for DataFrame.T property * Reorder docstring
1 parent 8ddd6a6 commit 35586f3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pandas/core/frame.py

+25
Original file line numberDiff line numberDiff line change
@@ -3569,6 +3569,31 @@ def transpose(self, *args, copy: bool = False) -> DataFrame:
35693569

35703570
@property
35713571
def T(self) -> DataFrame:
3572+
"""
3573+
The transpose of the DataFrame.
3574+
3575+
Returns
3576+
-------
3577+
DataFrame
3578+
The transposed DataFrame.
3579+
3580+
See Also
3581+
--------
3582+
DataFrame.transpose : Transpose index and columns.
3583+
3584+
Examples
3585+
--------
3586+
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
3587+
>>> df
3588+
col1 col2
3589+
0 1 3
3590+
1 2 4
3591+
3592+
>>> df.T
3593+
0 1
3594+
col1 1 2
3595+
col2 3 4
3596+
"""
35723597
return self.transpose()
35733598

35743599
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)