用pd.read_csv()读取后的.csv为空

时间:2019-04-10 10:13:04

标签: python-3.x pandas

运行后

df = pd.read_csv('my_file.csv')

我的原始.csv文件为空白。是否可以在不清空原始文件的情况下读取.csv数据?

1 个答案:

答案 0 :(得分:1)

pd.read_csv()不会修改文件!

在这里,使用pd.read_csv()之前的文件:

enter image description here

使用它:

enter image description here

现在,如果我们再次检查它,文件没有更改(按预期):

enter image description here

所以问题不在于pd.read_csv()。我假设您还有其他使事情变得混乱的代码。看看并告诉我们,以便我们可以为您提供更好的帮助。