简体   繁体   中英

How can I check values of an excel sheet using Python?

I have an Excel sheet, with data of stock prices and I want to build a code where I check if the guess is correct or not. So I need to compare my python value to the value on the Excel sheet.

I have tried using repl.it in a .csv file, but it was not compatible and I was not able to check my values. I have also tried using a .xlsx file on repl.it , but I still could not access the values.

Is there any way I can compare the values?

Try this:

import pandas as pd

table = pd.read_excel('file_name.xslx')

for row in table.values.tolist():
  first_value_in_row = row[0]
  second_value_in_row = row[1]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM