Skip to content

Commit 531d5cf

Browse files
committed
DOC: improve descriptions and linking in comparison includes
1 parent 1c0f204 commit 531d5cf

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

doc/source/getting_started/comparison/includes/case.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
The equivalent Python functions are ``upper``, ``lower``, and ``title``.
1+
The equivalent pandas methods are :meth:`Series.str.upper`, :meth:`Series.str.lower`, and
2+
:meth:`Series.str.title`.
23

34
.. ipython:: python
45

doc/source/getting_started/comparison/includes/find_substring.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
Python determines the position of a character in a string with the
2-
:func:`find` function. ``find`` searches for the first position of the
3-
substring. If the substring is found, the function returns its
4-
position. Keep in mind that Python indexes are zero-based and
5-
the function will return -1 if it fails to find the substring.
1+
You can find the position of a character in a column of strings with the :meth:`Series.str.find`
2+
method. ``find`` searches for the first position of the substring. If the substring is found, the
3+
method returns its position. If not found, it returns ``-1``. Keep in mind that Python indexes are
4+
zero-based.
65

76
.. ipython:: python
87

doc/source/getting_started/comparison/includes/length.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Python determines the length of a character string with the ``len`` function.
1+
You can find the length of a character string with :meth:`Series.str.len`.
22
In Python 3, all strings are Unicode strings. ``len`` includes trailing blanks.
33
Use ``len`` and ``rstrip`` to exclude trailing blanks.
44

doc/source/getting_started/comparison/includes/nth_word.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Python extracts a substring from a string based on its text
2-
by using regular expressions. There are much more powerful
3-
approaches, but this just shows a simple approach.
1+
The simplest way to extract words in pandas is to split the strings by spaces, then reference the
2+
word by index. Note there are more powerful approaches should you need them.
43

54
.. ipython:: python
65

doc/source/getting_started/comparison/includes/sorting.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
pandas objects have a :meth:`DataFrame.sort_values` method, which
2-
takes a list of columns to sort by.
1+
pandas has a :meth:`DataFrame.sort_values` method, which takes a list of columns to sort by.
32

43
.. ipython:: python
54

doc/source/getting_started/comparison/includes/transform.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pandas ``groupby`` provides a ``transform`` mechanism that allows these type of operations to be
1+
pandas provides a :ref:`groupby.transform` mechanism that allows these type of operations to be
22
succinctly expressed in one operation.
33

44
.. ipython:: python

0 commit comments

Comments
 (0)