简体   繁体   English

从Mac将CSV文件导入Spyder

[英]Importing a CSV file into Spyder from a mac

I'm just getting started with learning how utilize Spyder. 我刚刚开始学习如何利用Spyder。 I'm utilizing a mac to do so, if that makes any difference. 我正在使用mac这样做,如果有什么不同的话。 I'm having a horrible time opening up a csv file on my computer. 我在我的计算机上打开一个csv文件的时间真糟。 I'm wondering if someone can tell me what I'm doing wrong? 我想知道是否有人可以告诉我我做错了什么?

Here's the code I'm using: 这是我正在使用的代码:

import pandas as pd
one = pd.read_csv("~/Documents/2017Data/2017DATA.csv")

I get the following error when I execute the statements: 执行语句时出现以下错误:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 592: invalid start byte UnicodeDecodeError:“ utf-8”编解码器无法解码位置592中的字节0xb0:无效的起始字节

Try to use different encoding - 尝试使用其他编码-

import pandas as pd
one = pd.read_csv("~/Documents/2017Data/2017DATA.csv", encoding = "ISO-8859-1")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM