如何使用python中的openpyxl将if函数中的值插入数组?

2024-04-24 08:02:44 发布

您现在位置:Python中文网/ 问答频道 /正文

在这里,我尝试在列A和D中运行一个excel文件。我尝试从列A创建一个值的单列数组,其中列D的条件为true。我不知道如何将A列中相应的值输入到数组中。我也非常新的编码和不知道我在做什么很多,任何建议是感激的。你知道吗

for cell in clf['D']: #iterates through column D
if cell.value == 0:
    #insert into empty array corresponding values from column A 
    np.insert(array,0,clf['A'])
else:
    pass`

我的输出是

TypeError: float() argument must be a string or a number, not 'Cell'


Tags: 文件intrue编码forcellcolumn数组