how to shift left in python code example

Example 1: python list shift left

from collections import deque
items = deque([1, 2])
items.append(3)        # deque == [1, 2, 3]
items.rotate(1)        # The deque is now: [3, 1, 2]
items.rotate(-1)       # Returns deque to original state: [1, 2, 3]
item = items.popleft() # deque == [2, 3]

Example 2: shift in python

shift() is a pandas.DataFrame method that allows you to shift 
a line of value by a given number called period.
You can shift along rows, setting axis = 0, or along columns
setting axis = 1. For its complete usage, check the source link.