Below are Python equivalents for right, left, and mid functions, known as slices.


import pandas as pd

Create some dummy data

string = '8754321'
string
'8754321'
#right 2 characters
string[-2:]
'21'
#left 2 characters
string[:2]
'87'
#4th through 6th characters (index starts at 0)
string[4:6]
'32'




Copyright © Erik Rood 2017