Reading an Excel file in python using pandas

0 votes

I am trying to read an excel file this way :

newFile = pd.ExcelFile(PATH\FileName.xlsx)
ParsedData = pd.io.parsers.ExcelFile.parse(newFile)

which throws an error that says two arguments expected, I don't know what the second argument is and also what I am trying to achieve here is to convert an Excel file to a DataFrame, Am I doing it the right way? or is there any other way to do this using pandas?

Mar 28, 2022 in Database by Edureka
• 13,690 points
2,719 views

1 answer to this question.

0 votes

How to Use Pandas to Import an Excel File into Python
Step 1: Take a screenshot of the file path. To begin, you'll need to write down the exact path to the Excel file on your computer....
Step 2: Put the Python code into action. Here's the Python code we used in our example...
Step 3: Import the Excel file using Python code.

import pandas as pd

df = pd.read_excel (r'Path where the Excel file is stored\File name.xlsx')
print (df)


Note that you may need to use the 'xls' file extension if you're using an older version of Excel.

If you want to import a specific Excel sheet, you can use the following formula:

import pandas as pd

df = pd.read_excel (r'Path where the Excel file is stored\File name.xlsx', sheet_name='your Excel sheet name')
print (df)
answered Mar 30, 2022 by gaurav
• 23,260 points

Related Questions In Database

0 votes
0 answers

Modify an existing Excel file using Openpyxl in Python

I am basically trying to copy some ...READ MORE

Mar 25, 2022 in Database by Edureka
• 13,690 points
2,076 views
0 votes
1 answer

How to read a .xlsx file using the pandas Library in iPython?

Every sheet gets its own DataFrame, which ...READ MORE

answered Mar 25, 2022 in Database by anonymous
693 views
0 votes
1 answer

Pandas cannot open an Excel (.xlsx) file

XLRDError: Excel xlsx file not supported by ...READ MORE

answered Apr 4, 2022 in Database by gaurav
• 23,260 points
5,634 views
0 votes
1 answer

Save dynamically created table content in excel file using SheetJS

text inside tr instead of td in dynamic content. This results ...READ MORE

answered Apr 4, 2022 in Database by Edureka
• 13,690 points
3,658 views
0 votes
1 answer

How to download created excel file in node.js using exceljs

Download a sample Excel file using Node. ...READ MORE

answered Apr 4, 2022 in Database by Edureka
• 13,690 points
7,839 views
0 votes
1 answer

How to create an excel file in android?

In Android, create Excel XLSX or XLS ...READ MORE

answered Apr 4, 2022 in Database by Edureka
• 13,690 points
1,267 views
0 votes
1 answer

How to open a password protected excel file using python?

I recently came upon a Python package ...READ MORE

answered Apr 6, 2022 in Database by gaurav
• 23,260 points
10,047 views
0 votes
1 answer

Date difference: different results in Excel vs. Python

To calculate the date difference, we can ...READ MORE

answered Feb 23, 2022 in Database by gaurav
• 23,260 points
1,145 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP