简体   繁体   English

如何在for循环中一次从2个不同的数据帧中读取行?

[英]How to read lines from 2 different dataframes at one time in for loop?

I have 2 data frames: normal , cancer 我有2个数据框: normalcancer
and now I have a for loop to read them: 现在我有一个for循环来阅读它们:

for line in normal,cancer():    
    if len(line) < 20:        
        print('Insufficient')      
        continue   

which means I want to read these 2 data by line at one time in a for loop. 这意味着我想一次在for循环中逐行读取这2个数据。

How can I accomplish this? 我该怎么做?

Firstly, should cancer() be cancer ? 首先, cancer()应该是cancer吗? Is it a function? 是功能吗?

You could try doing a for lineNum, line in enumerate(normal) and then accessing cancer like cancer[lineNum] 你可以尝试做一个for lineNum, line in enumerate(normal) ,然后访问cancercancer[lineNum]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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