我有一个CSV文件,有100行和100列,如图所示。值都是浮点型数字。我试图写一个循环,它将访问每个值,比较它与一些部门和排序。什么是代码访问值从一个特定的索引?
enter image description here
while col<=100:
row=0
while row<=100:
dist=distf.1[row]
if else loop
row=row+1
col=col+1`
字符串
能做到这一点
我有一个CSV文件,有100行和100列,如图所示。值都是浮点型数字。我试图写一个循环,它将访问每个值,比较它与一些部门和排序。什么是代码访问值从一个特定的索引?
enter image description here
while col<=100:
row=0
while row<=100:
dist=distf.1[row]
if else loop
row=row+1
col=col+1`
字符串
能做到这一点
1条答案
按热度按时间68de4m5k1#
可以使用enumerate()函数:https://stackoverflow.com/a/16139758/19949392
或pandas库:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html