pandas - 名称“_Unspecified”未定义
问题描述
简单的 CSV 导入,但由于某种原因出现此错误,不明白为什么?
import pandas as pd
from sklearn.model_selection import train_test_split
data = pd.read_csv(r"C:\Users\train\Desktop\klopp.csv")
NameError:未定义名称“_Unspecified”
追溯..
runfile('C:/Users/train/Desktop/Spring 2020/Taylor/practice.py', wdir='C:/Users/train/Desktop/Spring 2020/Taylor') Traceback(最近一次通话最后):
文件“”,第 1 行,在运行文件中('C:/Users/train/Desktop/Spring 2020/Taylor/practice.py', wdir='C:/Users/train/Desktop/Spring 2020/Taylor')
文件“C:\Users\train\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”,第 827 行,运行文件 execfile(文件名,命名空间)
文件“C:\Users\train\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”,第 110 行,在 execfile exec(compile(f.read(), filename, 'exec'), namespace)
文件“C:/Users/train/Desktop/Spring 2020/Taylor/practice.py”,第 4 行,数据 = pd.read_csv(r"C:\Users\train\Desktop\klopp.csv")
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\io\parsers.py”,第 685 行,在 parser_f 返回 _read(filepath_or_buffer, kwds)
_read data = parser.read(nrows) 中的文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\io\parsers.py”,第 463 行
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\io\parsers.py”,第 1169 行,读取 df = DataFrame(col_dict, columns=columns, index=index)
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\core\frame.py”,第 411 行,在init mgr = init_dict(data, index, columns, dtype=dtype)
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\core\internals\construction.py”,第 236 行,在 init_dict 中,如果缺少.any() 而不是 is_integer_dtype(dtype):
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\core\generic.py”,第 11723 行,在logical_func filter_type="bool",
文件“C:\Users\train\Anaconda3\lib\site-packages\pandas\core\series.py”,第 4086 行,在 _reduce 中使用 np.errstate(all="ignore"):
文件“C:\Users\train\Anaconda3\lib\site-packages\numpy\core\numeric.py”,第 3055 行,在init
NameError:未定义名称“_Unspecified”
解决方案
推荐阅读
- c# - 在 while 循环 == false 之后,异步任务不会完成方法
- android - Android导航组件:跳转到目的地时恢复导航
- mysql - MySql 表列自动添加现有列
- javascript - Angular svg 作为显示为文本的组件的模板
- powershell - [Class]::New() 导致控制台出现空行
- python - 使用 OpenCV 从背景中裁剪图像(条带提取)
- computer-vision - 读取 mjsynth 数据集图像的问题
- delphi - Delphi 5 仅对整个单词使用 Pos / PosIgnoreCase
- linear-programming - 如何在 C++ 中使用 conshdlr 获取已添加到 SCIP 的切割数量和实际切割
- python-3.x - 如何在列中计算连续 1 并获得每组的最大计数