macでpythonからcsvを読み込む場合はどのように設定すれば良いでしょうか?
下記のようなコードを作成しましたが、実行するとエラーが表示されます。
コード
import pandas as pd #pandasをpdとしてインポート
df = pd.read_csv("/Users/ha/Desktop/tati.csv", encoding="utf-8_sig")
print (df)
エラーメッセージ
Traceback (most recent call last):
File "casa.py", line 3, in <module>
df = pd.read_csv("/Users/ha/Desktop/tati.csv", encoding="utf-8_sig")
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 702, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 435, in _read
data = parser.read(nrows)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1139, in read
ret = self._engine.read(nrows)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1995, in read
data = self._reader.read(nrows)
File "pandas/_libs/parsers.pyx", line 899, in pandas._libs.parsers.TextReader.read
File "pandas/_libs/parsers.pyx", line 914, in pandas._libs.parsers.TextReader._read_low_memory
File "pandas/_libs/parsers.pyx", line 991, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 1123, in pandas._libs.parsers.TextReader._convert_column_data
File "pandas/_libs/parsers.pyx", line 1176, in pandas._libs.parsers.TextReader._convert_tokens
File "pandas/_libs/parsers.pyx", line 1299, in pandas._libs.parsers.TextReader._convert_with_dtype
File "pandas/_libs/parsers.pyx", line 1318, in pandas._libs.parsers.TextReader._string_convert
File "pandas/_libs/parsers.pyx", line 1611, in pandas._libs.parsers._string_box_decode
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/encodings/utf_8_sig.py", line 23, in de
code
(output, consumed) = codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 0: invalid start byte