Efficient pandas operation to get a new column from a shifted value of another column (with additional rules)
Efficient pandas operation to get a new column from a shifted value of another column (with additional rules) Question: I have a dataframe like the following: >>> df = pd.DataFrame({‘days’:[‘Fri’, ‘Sat’, ‘Sun’, ‘Mon’, ‘Tues’, ‘Wed’, ‘Thurs’], ‘values’:[1, 2, 3, 4, 5, 6, 7]}) >>> df days values 0 Fri 1 1 Sat 2 2 Sun …