Python XLS Data Processing

Microsoft Excel is developed and published by the Microsoft Offices. Excel is widely used in the world ,excel basically used for processing data with graphical data,Excel is a tool for organizing and performing calculations on data.here we read_excel for read xls file.

Name,Phone,Address,RollNo,Class
Rohan,8765435687,India,001,5
Sohan,4565465466,India,002,5
Reema,4987654765,India,003,5
Archana,987654556,India,004,5

Program

#importing pandas library
import pandas as pd
#reading excel file
abc = pd.read_excel('path/info.xlsx')
print (abc)

Output

Name         Phone         Address        RollNo        Class
Rohan    8765435687         India          001           5
Sohan    4565465466         India          002           5
Reema    4987654765         India          003           5
Archana  987654556          India          004           5

Reading Specific File

Pandas allow to read and process the specific rows and column,with help of using the loc() function of pandas,

#importing  pandas library
import pandas as pd
#read excel file
abc = pd.read_excel('path/info.xlsx')

# reading multidimensional axis 
print (abc.loc[[1,2,3],['Name','Address']])

Output

      Name            Address
1     Rohan           India 
2     Sohan           India 
3     Reema           India 
Subscribe Now