File: find_substring.rst

package info (click to toggle)
pandas 2.2.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,784 kB
  • sloc: python: 422,228; ansic: 9,190; sh: 270; xml: 102; makefile: 83
file content (8 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
You can find the position of a character in a column of strings with the :meth:`Series.str.find`
method. ``find`` searches for the first position of the substring. If the substring is found, the
method returns its position. If not found, it returns ``-1``. Keep in mind that Python indexes are
zero-based.

.. ipython:: python

   tips["sex"].str.find("ale")