TypeError:参数应该是字符串,字节或整数,而不是元组

时间:2017-01-10 20:43:37

标签: python

TypeError: argument should be string, bytes or integer, not tuple

我对编码非常陌生,我正在开发一个应该从两个.csv文件中读取数据的脚本。 file_one跳过前三行,file_two发送前两列。我在下面的代码部分得到了上述错误。

if os.path.exists(file_one_path) and os.path.exists(file_two_path):
file_one = pd.read_csv(file_one_path)
file_two = pd.read_csv(file_two_path)
try:
    assert (file_one.shape[0] == file_one.shape[0])
except AssertionError:
    print ("Please check the data provided.")
    exit()

* pd是pandas

    Traceback (most recent call last):

  File "<ipython-input-54-e2504f2fa109>", line 1, in <module>
    runfile('C:/Users/..., wdir='C:/Users/.....)

  File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/.......", line 29, in <module>
    if os.path.exists(file_one_path) and os.path.exists(file_two_path):

  File "C:\Anaconda3\lib\genericpath.py", line 19, in exists
    os.stat(path)

TypeError: argument should be string, bytes or integer, not tuple

0 个答案:

没有答案