I have a df in pandas
import pandas as pd
df = pd.DataFrame(['AA', 'BB', 'CC'], columns = ['value'])
I want to iterate over rows in df. For each row i want rows value and next row
s value
Something like(it does not work):
for i, row in df.iterrows():
print row['value']
i1, row1 = next(df.iterrows())
print row1['value']
As a result I want
'AA'
'BB'
'BB'
'CC'
'CC'
*Wrong index error here
At this point i have mess way to solve this
for i in range(0, df.shape[0])
print df.irow(i)['value']
print df.irow(i+1)['value']
Is there more efficient way to solve this issue?