Skip to content

Commit 2b58382

Browse files
zhujun98victor
authored and
victor
committed
DOC: fix return type of str.extract (pandas-dev#22562)
1 parent 20ec315 commit 2b58382

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pandas/core/strings.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,9 @@ def str_extract(arr, pat, flags=0, expand=True):
857857
pat : string
858858
Regular expression pattern with capturing groups.
859859
flags : int, default 0 (no flags)
860-
``re`` module flags, e.g. ``re.IGNORECASE``.
861-
See :mod:`re`
860+
Flags from the ``re`` module, e.g. ``re.IGNORECASE``, that
861+
modify regular expression matching for things like case,
862+
spaces, etc. For more details, see :mod:`re`.
862863
expand : bool, default True
863864
If True, return DataFrame with one column per capture group.
864865
If False, return a Series/Index if there is one capture group
@@ -868,13 +869,15 @@ def str_extract(arr, pat, flags=0, expand=True):
868869
869870
Returns
870871
-------
871-
DataFrame with one row for each subject string, and one column for
872-
each group. Any capture group names in regular expression pat will
873-
be used for column names; otherwise capture group numbers will be
874-
used. The dtype of each result column is always object, even when
875-
no match is found. If expand=False and pat has only one capture group,
876-
then return a Series (if subject is a Series) or Index (if subject
877-
is an Index).
872+
DataFrame or Series or Index
873+
A DataFrame with one row for each subject string, and one
874+
column for each group. Any capture group names in regular
875+
expression pat will be used for column names; otherwise
876+
capture group numbers will be used. The dtype of each result
877+
column is always object, even when no match is found. If
878+
``expand=False`` and pat has only one capture group, then
879+
return a Series (if subject is a Series) or Index (if subject
880+
is an Index).
878881
879882
See Also
880883
--------

0 commit comments

Comments
 (0)