Skip to content

Commit 4e1f8dd

Browse files
made code segments as ipython blocks
changed python code segments from code-block:: none to ipython:: python
1 parent a68fe9f commit 4e1f8dd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/source/comparison_with_sas.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ Python determines the length of a character string with the ``len`` function.
380380
``len`` includes trailing blanks. Use ``len`` and ``rstrip`` to exclude
381381
trailing blanks.
382382

383-
.. code-block:: none
383+
.. ipython:: python
384384
385385
tips['time'].str.len()
386386
tips['time'].str.rstrip().str.len()
@@ -407,7 +407,7 @@ substring. If the substring is found, the function returns its
407407
position. Keep in mind that Python indexes are zero-based and
408408
the function will return -1 if it fails to find the substring.
409409

410-
.. code-block:: none
410+
.. ipython:: python
411411
412412
tips['sex'].str.find("ALE")
413413
@@ -429,7 +429,7 @@ In Python, you can use ``[]`` notation to extract a substring
429429
from a string by position locations. Keep in mind that Python
430430
indexes are zero-based.
431431

432-
.. code-block:: none
432+
.. ipython:: python
433433
434434
tips['sex'].str[0:1]
435435
@@ -457,7 +457,7 @@ Python extracts a substring from a string based on its text
457457
by using regular expressions. There are much more powerful
458458
approaches, but this just shows a simple approach.
459459

460-
.. code-block:: none
460+
.. ipython:: python
461461
462462
firstlast = pd.DataFrame({'String': ['John Smith', 'Jane Cook']})
463463
firstlast['First_Name'] = firstlast['String'].str.split(" ", expand=True)[0]
@@ -485,7 +485,7 @@ the case of the argument.
485485
486486
The equivalent Python functions are ``upper``, ``lower``, and ``title``.
487487

488-
.. code-block:: none
488+
.. ipython:: python
489489
490490
firstlast = pd.DataFrame({'String': ['John Smith', 'Jane Cook']})
491491
firstlast['string_up'] = firstlast['String'].str.upper()

0 commit comments

Comments
 (0)