So I am trying to achieve this I have data frame in pandas and have given a variable where a user inputs a number and if the the number matches the index number in dataframe, i want to display 3 rows above and 3 rows below data from the the dataframe.
what data i have
user_number = int(input('Input Number : '))
print(user_number)
Country Result
0 China N
1 India N
2 Brazil Y
3 Indonesia N
4 Bhutan N
5 Mexico Y
6 Canada N
7 Peru N
8 Honduras N
9 Bhutan N
example if user inputs 5 i want row 2,3,4 and row 6,7,8 to be displayed
What Result i want to achieve:
2 Brazil Y
3 Indonesia N
4 Bhutan N
5 Mexico Y
6 Canada N
7 Peru N
8 Honduras N