我一直致力于将字符串变量“revenue”放入pandas数据帧df1
。如你所见,我用了df.ait
关于代码的更多细节:它是关于通过m counting循环查找特定的日期行
我的问题发生在.iat
if info[1] == "1": #Get Kikko1
listofdates = df.Date.tolist()
m = 0
for i in listofdates:
if i != date: #Counting the rows
m = m+1
elif i == date: #Select the row with the matched date
df.iat[m, 9] = "revenue"
break
错误显示:
IndexError: index 36 is out of bounds for axis 0 with size 31
使用pandas这样的包的一个主要好处是避免了这种手动循环,这种循环很难遵循和修改
我想你可以在一条线上做你想做的事。比如:
如果这不起作用,你能在你的问题中编辑一些示例数据和你想要的输出吗
相关问题 更多 >
编程相关推荐