import pandas as pd
my_data = pd.read_excel('D:\student.xlsx')
print(my_data)
Output
id name class mark sex
0 1 John Deo Four 75 female
1 2 Max Ruin Three 85 male
2 3 Arnold Three 55 male
3 4 Krish Star Four 60 female
----------------
----------------
---------------
You can display all 35 rows , Now let us try our sample scripts.import pandas as pd
my_data = pd.read_excel('D:\student.xlsx')
print(my_data.at[1,'name']) # row 1, column='name'
Output
Max Ruin
We will set ( update ) the name at 2nd row. We will use at to first read the data at perticular location.
import pandas as pd
my_data = pd.read_excel('D:\student.xlsx')
# getting the name
print(my_data.loc[2].at['name']) # Arnold
print(my_data.at[2,'name']) # Arnold
Above code will display the name at row 2. Now let us update the name with Arnold2 and again read the data.
import pandas as pd
my_data = pd.read_excel('D:\student.xlsx')
# updatting data
my_data.at[2,'name']='Arnold2'
print(my_data.at[2,'name']) # Arnold2
Output
Arnold2
loc mask
where
query
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.