简体   繁体   English

如何使用 Python 检查 excel 表的值?

[英]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.

相关问题 如何使用 openpyxl 库将列从一张 excel 表复制到另一张 python? - How can I copy columns from one excel sheet to another with python using openpyxl Library? 如何使用 Python 和 openpyxl 替换 Excel 工作表中的 HTML 代码? - How can I replace HTML code inside an excel sheet using Python and openpyxl? 如何使用Pandas将python Web抓取数据导出到现有excel文件中的特定工作表? - How can I export my python web scrape data to a specific sheet in an existing excel file using pandas? 如何使用python从excel表创建pdf报告? - How can I create a pdf report from an excel sheet using python? 我如何使用python和beautifulsoup从嵌入html的Excel工作表中提取数据? - How can i extract data from an excel sheet embedded in html using python and beautifulsoup? 使用python从excel表中删除值 - Remove values from excel sheet using python 如何更改Python的Excel工作表标签背景颜色 - How, I can change Excel sheet tab background colour by python 如何让 python 在 excel 表上找到这个词? - How can I make python find this word on an excel sheet? 我想使用 Python 检查 sheet1 中某个列上的值是否也存在于 sheet2 上 - I want to Check if the values present on a certain column from sheet1 are also present on sheet2 using Python 如何使用python动态创建新的Excel工作表? - How do I create a new excel sheet dynamically using python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM