Skip to content

Commit 873bbc2

Browse files
gambogijreback
authored andcommitted
DOC: Add docstrings to DataFrame properties, #10421
Explanations for `axes` and `shape`.
1 parent 2ef546d commit 873bbc2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

pandas/core/frame.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,17 @@ def _get_axes(N, K, index=index, columns=columns):
414414

415415
@property
416416
def axes(self):
417+
"""
418+
Return a list with the row axis labels and column axis labels as the
419+
only members. They are returned in that order.
420+
"""
417421
return [self.index, self.columns]
418422

419423
@property
420424
def shape(self):
425+
"""
426+
Return a tuple representing the dimensionality of the DataFrame.
427+
"""
421428
return (len(self.index), len(self.columns))
422429

423430
def _repr_fits_vertical_(self):

pandas/core/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ def _stat_axis(self):
382382

383383
@property
384384
def shape(self):
385-
"tuple of axis dimensions"
385+
"Return a tuple of axis dimensions"
386386
return tuple(len(self._get_axis(a)) for a in self._AXIS_ORDERS)
387387

388388
@property
389389
def axes(self):
390-
"index(es) of the NDFrame"
390+
"Return index label(s) of the internal NDFrame"
391391
# we do it this way because if we have reversed axes, then
392392
# the block manager shows then reversed
393393
return [self._get_axis(a) for a in self._AXIS_ORDERS]

pandas/core/series.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ def _unpickle_series_compat(self, state):
468468
# indexers
469469
@property
470470
def axes(self):
471+
"""
472+
Return a list of the row axis labels
473+
"""
471474
return [self.index]
472475

473476
def _ixs(self, i, axis=0):

0 commit comments

Comments
 (0)