CSVファイルの読み込みができません。
import pandas as pd
import matplotlib.pyplot as plt
#data input
df_2021 = pd.read_csv('2021.csv',engine="python")
df_2021
結果
>>> #data input
>>> df_2021 = pd.read_csv('2021.csv',engine="python")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python38\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Python38\lib\site-packages\pandas\io\parsers\readers.py", line 680, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Python38\lib\site-packages\pandas\io\parsers\readers.py", line 575, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "C:\Python38\lib\site-packages\pandas\io\parsers\readers.py", line 933, in __init__
self._engine = self._make_engine(f, self.engine)
File "C:\Python38\lib\site-packages\pandas\io\parsers\readers.py", line 1235, in _make_engine
return mapping[engine](f, **self.options)
File "C:\Python38\lib\site-packages\pandas\io\parsers\python_parser.py", line 115, in __init__
) = self._infer_columns()
File "C:\Python38\lib\site-packages\pandas\io\parsers\python_parser.py", line 364, in _infer_columns
line = self._buffered_line()
File "C:\Python38\lib\site-packages\pandas\io\parsers\python_parser.py", line 596, in _buffered_line
return self._next_line()
File "C:\Python38\lib\site-packages\pandas\io\parsers\python_parser.py", line 696, in _next_line
orig_line = self._next_iter_line(row_num=self.pos + 1)
File "C:\Python38\lib\site-packages\pandas\io\parsers\python_parser.py", line 760, in _next_iter_line
line = next(self.data)
File "C:\Python38\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 441: invalid start byte
>>> df_2021
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'df_2021' is not defined