Skip to content

Commit e9cfaf6

Browse files
committed
Updated documentation for mode()
Improved after review. Backtick for code mode, new paragraph for the note, iloc instead of ix for integer indices.
1 parent 3273453 commit e9cfaf6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/core/frame.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -4413,11 +4413,12 @@ def mode(self, axis=0, numeric_only=False):
44134413
"""
44144414
Gets the mode(s) of each element along the axis selected. Empty if nothing
44154415
has 2+ occurrences. Adds a row for each mode per label, fills in gaps
4416-
with nan. Note that there could be multiple values returned for the selected
4416+
with nan.
4417+
Note that there could be multiple values returned for the selected
44174418
axis (when more than one item share the maximum frequency), which is the
4418-
reason why a dataframe is returned. This means that if you want to impute
4419-
missing values with the mode in a dataframe df, you can just do this:
4420-
df.fillna(df.mode().ix[0])
4419+
reason why a dataframe is returned. If you want to impute missing values
4420+
with the mode in a dataframe ``df``, you can just do this:
4421+
``df.fillna(df.mode().iloc[0])``
44214422
44224423
Parameters
44234424
----------

0 commit comments

Comments
 (0)