@@ -898,23 +898,94 @@ def str_join(arr, sep):
898898
899899def str_findall (arr , pat , flags = 0 ):
900900 """
901- Find all occurrences of pattern or regular expression in the
902- Series/Index. Equivalent to :func:`re.findall`.
901+ Find all occurrences of pattern or regular expression in the Series/Index.
902+
903+ Equivalent to applying :func:`re.findall` to all the elements in the
904+ Series/Index.
903905
904906 Parameters
905907 ----------
906908 pat : string
907- Pattern or regular expression
908- flags : int, default 0 (no flags)
909- re module flags, e.g. re.IGNORECASE
909+ Pattern or regular expression.
910+ flags : int, default 0
911+ ``re`` module flags, e.g. `re.IGNORECASE` (default is 0, which means
912+ no flags).
910913
911914 Returns
912915 -------
913- matches : Series/Index of lists
916+ Series/Index of lists of strings
917+ All non-overlapping matches of pattern or regular expression in each
918+ string of this Series/Index.
914919
915920 See Also
916921 --------
917- extractall : returns DataFrame with one column per capture group
922+ count : Count occurrences of pattern or regular expression in each string
923+ of the Series/Index.
924+ extractall : For each string in the Series, extract groups from all matches
925+ of regular expression and return a DataFrame with one row for each
926+ match and one column for each group.
927+ re.findall : The equivalent ``re`` function to all non-overlapping matches
928+ of pattern or regular expression in string, as a list of strings.
929+
930+ Examples
931+ --------
932+
933+ >>> s = pd.Series(['Lion', 'Monkey', 'Rabbit'])
934+
935+ The search for the pattern 'Monkey' returns one match:
936+
937+ >>> s.str.findall('Monkey')
938+ 0 []
939+ 1 [Monkey]
940+ 2 []
941+ dtype: object
942+
943+ On the other hand, the search for the pattern 'MONKEY' doesn't return any
944+ match:
945+
946+ >>> s.str.findall('MONKEY')
947+ 0 []
948+ 1 []
949+ 2 []
950+ dtype: object
951+
952+ Flags can be added to the pattern or regular expression. For instance,
953+ to find the pattern 'MONKEY' ignoring the case:
954+
955+ >>> import re
956+ >>> s.str.findall('MONKEY', flags=re.IGNORECASE)
957+ 0 []
958+ 1 [Monkey]
959+ 2 []
960+ dtype: object
961+
962+ When the pattern matches more than one string in the Series, all matches
963+ are returned:
964+
965+ >>> s.str.findall('on')
966+ 0 [on]
967+ 1 [on]
968+ 2 []
969+ dtype: object
970+
971+ Regular expressions are supported too. For instance, the search for all the
972+ strings ending with the word 'on' is shown next:
973+
974+ >>> s.str.findall('on$')
975+ 0 [on]
976+ 1 []
977+ 2 []
978+ dtype: object
979+
980+ If the pattern is found more than once in the same string, then a list of
981+ multiple strings is returned:
982+
983+ >>> s.str.findall('b')
984+ 0 []
985+ 1 []
986+ 2 [b, b]
987+ dtype: object
988+
918989 """
919990 regex = re .compile (pat , flags = flags )
920991 return _na_map (regex .findall , arr )
0 commit comments