pandas - 当我尝试在 python 中导入时,.csv 文件返回“unicode 错误”
问题描述
我正在尝试在 Jupyter 笔记本上使用 pandas 导入 .csv 数据集文件。我不断收到相同的“unicode decode error”消息
我已经尝试过使用和不(r'file name')
使用反斜杠并加倍使用反斜杠,以及使用正斜杠
这是我的代码
import pandas as pd
df = pd.read_csv(r'C:\users\justanotheregg\Downloads\medals.csv')
这是我收到的一部分
UnicodeDecodeError Traceback (most recent call last)
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_tokens()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_with_dtype()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._string_convert()
pandas/_libs/parsers.pyx in pandas._libs.parsers._string_box_utf8()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 12: invalid start byte
During handling of the above exception, another exception occurred:
解决方案
推荐阅读
- dc.js - 没有过滤器应用于 DC.js 图表时的条件自定义 X 值暗淡名称
- css - 向材料表中的列添加特定的最小宽度
- kotlin - Kotlin 适配器声明问题:类型不匹配:推断类型是 MyTabAdapter 但 RecyclerView.Adapter<(raw) RecyclerView.ViewHolder!>?预计
- typescript - 使用 Typescript 初始化 Text.defaultProps
- node.js - 如何针对特定平台定位节点应用程序
- java - 使用银行App切换功能出错
- c++ - 结构体与 printf() 一起使用
- python - 使用有向图在 Python 中实现寻路
- javascript - 在 amcharts4 雷达图上旋转 CategoryAxis 标签
- reactjs - 如何将 NavLink activeStyles 应用于其子组件