[英]EmptyDataError: No columns to parse from file
Currently I am getting the below Error and I am tried out the below posts:目前我收到以下错误,我尝试了以下帖子:
But I am not able to get the error resolved.但我无法解决错误。 My python code is as below:
我的python代码如下:
import pandas as pd
testdata = pd.read_csv(file_name, header=None, delim_whitespace=True)
I tried to print the value in testdata but it doesn't show any output.我试图打印 testdata 中的值,但它没有显示任何输出。
The following is my csvfile:以下是我的 csvfile:
Firstly, declare your filename inside testdata
as a string, and make sure it is either in the local directory, or that you have the correct filepath.首先,将
testdata
中的文件名声明为字符串,并确保它位于本地目录中,或者您具有正确的文件路径。
import pandas as pd
testdata = pd.read_csv("filename.csv", header=None, delim_whitespace=True)
If that does not work, post some information about the environment you are using.如果这不起作用,请发布有关您正在使用的环境的一些信息。
First, you probably don't need header=None as you seem to have headers in the file.首先,您可能不需要 header=None ,因为您似乎在文件中有标题。 Also try removing the blank line between the headers and the first line of data.
还可以尝试删除标题和第一行数据之间的空行。 Check and double check your file name.
检查并仔细检查您的文件名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.