我想下载列号,例如1,3,2。在param.txt文件中,我只有这样一个条目
import pandas as pd
import numpy as np
df = pd.read_csv('sample1.csv')
with open('param.txt') as f:
s = f.read()
b = df.iloc[:, [s]]
print(b.to_string(index=False))
当我开始写剧本的时候
raise IndexError(f".iloc requires numeric indexers, got {arr}")
IndexError: .iloc requires numeric indexers, got ['1,3,2']
如何简单地从这种形式转换为数字形式
谢谢你的帮助
假设f.read()返回“1,2,3”,这应该可以工作
相关问题 更多 >
编程相关推荐