extracting data from excel using python

Viewed 23

Here is the following code from which I am trying to pull out cell-data.

import pandas as pd

excel_file = "testfile.xls"

xldata = pd.read_excel(excel_file, sheet_name='blank')
xlvalue1 = xldata[2][0]
print(xlvalue1)

Also, I am using jupyterlab

In place of using numbers for xldata[2][0] I've tried using the specific name of the column and row and regardless, am getting the following error message:


KeyError Traceback (most recent call last) File ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py:3621, in Index.get_loc(self, key, method, tolerance) 3620 try: -> 3621 return self._engine.get_loc(casted_key) 3622 except KeyError as err:

0 Answers
Related