Let's say that I have the following DataFrame:
# Import pandas library
import pandas as pd
# initialize list of lists
data = [['tom', 10], ['tom', 10], ['sam', 23], ['sam', 23], ['sam', 23], ['alice', 23], ['alice', 30], ['alice', 30]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns=['Name', 'Age'])
# print dataframe.
df
Name Age
0 tom 10
1 tom 10
2 sam 23
3 sam 23
4 sam 23
5 alice 23
6 alice 30
7 alice 30
A data error occurs in the data where the 'Age' value does not change with a new consecutive 'Name' entry. In other words, row 5 contains a data entry error. How could I go about detecting and printing the rows in which this occurs? Thank you.