PYTHON报错:Value error:could not convert string to float
Python的报错:Value error:could not convert string to float,跪求大神指点
TXT文件Python的报错:Value error:could not convert string to float,跪求大神指点
TXT文件读取的代码:
txt = np.loadtxt(‘E:\DataSet\CCTSDB\GroundTruth\GroundTruth.txt’)
txtDF = pd.DataFrame(txt)
txtDF.to_csv(‘file1.csv’, index=False)
def csv_data():
csv_data = pd.read_csv(“file1.csv”, names=[“file_num”,“labels”,“style”], index_col=“file_num”)
labels = []
labels = csv_batch_data[list(range(1,4))]
return csv_data
def filename2label(filename, csv_data):
labels = []
for file_name in filename:
file_num = “”.join(list(file_name))
target = csv_data.loc[int(file_num),“label”]
labels.append(target)
return np.array(labels)

相关文章:

  • 2022-12-23
  • 2021-07-27
  • 2022-02-25
  • 2021-09-14
  • 2022-01-15
  • 2022-12-23
  • 2021-06-22
  • 2021-04-01
猜你喜欢
  • 2021-04-03
  • 2021-10-23
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
相关资源
相似解决方案