csv가 아닌 엑셀로 저장된 파일 데이터로 활용할때
pd.read_excel('../data/population_in_Seoul.xls')
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File ~\anaconda3\envs\YH\lib\site-packages\pandas\compat\_optional.py:138, in import_optional_dependency(name, extra, errors, min_version)
137 try:
--> 138 module = importlib.import_module(name)
139 except ImportError:
File ~\anaconda3\envs\YH\lib\importlib\__init__.py:127, in import_module(name, package)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
File <frozen importlib._bootstrap>:1014, in _gcd_import(name, package, level)
File <frozen importlib._bootstrap>:991, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:973, in _find_and_load_unlocked(name, import_)
ModuleNotFoundError: No module named 'xlrd'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
Cell In [16], line 1
----> 1 pd.read_excel('../data/population_in_Seoul.xls')
File ~\anaconda3\envs\YH\lib\site-packages\pandas\util\_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
305 if len(args) > num_allow_args:
306 warnings.warn(
307 msg.format(arguments=arguments),
308 FutureWarning,
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)
File ~\anaconda3\envs\YH\lib\site-packages\pandas\io\excel\_base.py:457, in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, decimal, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
455 if not isinstance(io, ExcelFile):
456 should_close = True
--> 457 io = ExcelFile(io, storage_options=storage_options, engine=engine)
458 elif engine and engine != io.engine:
459 raise ValueError(
460 "Engine should not be specified when passing "
461 "an ExcelFile - ExcelFile already has the engine set"
462 )
File ~\anaconda3\envs\YH\lib\site-packages\pandas\io\excel\_base.py:1419, in ExcelFile.__init__(self, path_or_buffer, engine, storage_options)
1416 self.engine = engine
1417 self.storage_options = storage_options
-> 1419 self._reader = self._engines[engine](self._io, storage_options=storage_options)
File ~\anaconda3\envs\YH\lib\site-packages\pandas\io\excel\_xlrd.py:24, in XlrdReader.__init__(self, filepath_or_buffer, storage_options)
13 """
14 Reader using xlrd engine.
15
(...)
21 passed to fsspec for appropriate URLs (see ``_get_filepath_or_buffer``)
22 """
23 err_msg = "Install xlrd >= 1.0.0 for Excel support"
---> 24 import_optional_dependency("xlrd", extra=err_msg)
25 super().__init__(filepath_or_buffer, storage_options=storage_options)
File ~\anaconda3\envs\YH\lib\site-packages\pandas\compat\_optional.py:141, in import_optional_dependency(name, extra, errors, min_version)
139 except ImportError:
140 if errors == "raise":
--> 141 raise ImportError(msg)
142 else:
143 return None
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
이러한 오류가 나온다.
모듈을 찾을수 없다는 뜻
이러한 라이브러리가 없다는 뜻으로 설치를 따로 해줘야 한다
엑셀처리하는 라이브러리를 설치해야지 사용할 수 있다.
먼저 아나콘다를 실행한후 사용할 환경을 실행후 그곳에다가
conda install xlrd
or
pip isntall xlrd
'오류' 카테고리의 다른 글
ec2 private한 repository clone 및 pull (0) | 2022.12.21 |
---|---|
ec2 서버 실행시 bash: syntax error near unexpected token `(' (0) | 2022.12.21 |
데이터프레임안 문자열로된 숫자데이터 int로 바꾸기 (0) | 2022.11.29 |
csv 불러오기 유니코드 오류 (0) | 2022.11.28 |
넘파이 액세스 boolean 연산중 오류 (0) | 2022.11.23 |