Imagine I have a dataframe as below. And I can print the output as
2
4
6
import pandas as pd
data = [[1,2,'a'],[3,4,'b'],[5,6,'c']]
columns = ['a','b','c']
df = pd.DataFrame(data ,columns = ['a','b','c'])
for i in df.itertuples():
print(i.b)
Now Imagine I need to print the next line value from starting row always.How can I do that. Basically I need the output of only
4
6
How can I do it.
My approach is like below:
for i in df.itertuples():
# here there should be a if function asking not to go for the last row (first row from upside down of the dataframe)
print((i+1).b)