[英]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.我有一张 Excel 表,其中包含股票价格数据,我想构建一个代码来检查猜测是否正确。 So I need to compare my python value to the value on the Excel sheet.所以我需要将我的 python 值与 Excel 表上的值进行比较。
I have tried using repl.it
in a .csv
file, but it was not compatible and I was not able to check my values.我曾尝试在.csv
文件中使用repl.it
,但它不兼容,我无法检查我的值。 I have also tried using a .xlsx
file on repl.it
, but I still could not access the values.我也尝试在repl.it
上使用.xlsx
文件,但我仍然无法访问这些值。
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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.