When I did read_csv of pandas, it could not be read due to an error.
sample.py
import pandas as pd
df = pd.read_csv("hoge.csv")
Error message
UnicodeDecodeError:'utf-8' codec can't decode byte 0x95 in position 0: invalid start byte
I added ʻencoding ='cp932'` and it worked.
sample.py
import pandas as pd
df = pd.read_csv("hoge.csv",encoding='cp932')
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ()) I referred to the comments from.
Thank you very much.
Recommended Posts