[英]Reading particular row from excel file without reading it completely
I have a very large excel file, above 30 MB.我有一个非常大的 excel 文件,超过 30 MB。 The excel file is for a state, and it contains many rows.
excel 文件用于 state,它包含许多行。 Each row represents a village in the state.
每行代表 state 中的一个村庄。 Now given the village name, I need to read the particular row from the excel file.
现在给定村名,我需要从 excel 文件中读取特定行。
I am currently using df = pd.read_excel()
to read the file and then finding the particular row using df.loc
.我目前正在使用
df = pd.read_excel()
读取文件,然后使用df.loc
查找特定行。
I would like to know if there is any approach in which I don't have to read in the complete file for extracting a single row.我想知道是否有任何方法我不必读取完整的文件来提取单行。 This is because reading the entire file takes a lot of time.
这是因为读取整个文件需要很多时间。
Any help/suggestions would be really helpful.任何帮助/建议都会非常有帮助。 Thanks !
谢谢 !
You can use the openpyxl module and iterate over your file.您可以使用 openpyxl 模块并遍历您的文件。 https://openpyxl.readthedocs.io/en/stable/tutorial.html
https://openpyxl.readthedocs.io/en/stable/tutorial.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.