用分号将CSV分成单独的列

时间:2019-10-20 20:37:21

标签: python pandas jupyter-notebook anaconda

我必须使用提供的数据集训练一种评估葡萄酒的算法。但是,该数据集将所有数据集中在1列中(用分号分隔),我不确定如何拆分它们。

This is the output of the data the way it is currently formatted 我已经尝试了下面的代码和其他一些方法,但是将它们全部放入一个数组中,我想使用它来处理表/数据框:

df2 = []

将open('winequality-white.csv','r')读为:     file_input = reading.read()。split('\ n')

对于file_input中的行:     df2.append(row.split(';'))

print(df2)

为什么这不起作用,我应该如何拆分它?

0 个答案:

没有答案
相关问题