강의

멘토링

로드맵

인프런 커뮤니티 질문&답변

khoyeon0323님의 프로필 이미지
khoyeon0323

작성한 질문수

pandas-profiling 사용 문제

작성

·

1.4K

0

---------------------------------------------------------------------------
PydanticImportError                       Traceback (most recent call last)
Cell In[207], line 8
      6 from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
      7 from sklearn.linear_model import LinearRegression
----> 8 from pandas_profiling import ProfileReport

File ~\anaconda3\Lib\site-packages\pandas_profiling\__init__.py:6
      1 """Main module of pandas-profiling.
      2 
      3 .. include:: ../../README.md
      4 """
----> 6 from pandas_profiling.controller import pandas_decorator
      7 from pandas_profiling.profile_report import ProfileReport
      8 from pandas_profiling.version import __version__

File ~\anaconda3\Lib\site-packages\pandas_profiling\controller\pandas_decorator.py:4
      1 """This file add the decorator on the DataFrame object."""
      2 from pandas import DataFrame
----> 4 from pandas_profiling.profile_report import ProfileReport
      7 def profile_report(df: DataFrame, **kwargs) -> ProfileReport:
      8     """Profile a DataFrame.
      9 
     10     Args:
   (...)
     15         A ProfileReport of the DataFrame.
     16     """

File ~\anaconda3\Lib\site-packages\pandas_profiling\profile_report.py:13
     10 from tqdm.auto import tqdm
     11 from visions import VisionsTypeset
---> 13 from pandas_profiling.config import Config, Settings
     14 from pandas_profiling.expectations_report import ExpectationsReport
     15 from pandas_profiling.model.alerts import AlertType

File ~\anaconda3\Lib\site-packages\pandas_profiling\config.py:5
      2 from enum import Enum
      3 from typing import Any, Dict, List, Optional
----> 5 from pydantic import BaseModel, BaseSettings, Field
      8 def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
      9     """
     10     Recursive merge dictionaries.
     11 
   (...)
     14     :return: Merged dictionary
     15     """

File ~\anaconda3\Lib\site-packages\pydantic\__init__.py:210, in __getattr__(attr_name)
    208 dynamic_attr = _dynamic_imports.get(attr_name)
    209 if dynamic_attr is None:
--> 210     return _getattr_migration(attr_name)
    212 from importlib import import_module
    214 module = import_module(_dynamic_imports[attr_name], package=__package__)

File ~\anaconda3\Lib\site-packages\pydantic\_migration.py:289, in getattr_migration.<locals>.wrapper(name)
    287     return import_string(REDIRECT_TO_V1[import_path])
    288 if import_path == 'pydantic:BaseSettings':
--> 289     raise PydanticImportError(
    290         '`BaseSettings` has been moved to the `pydantic-settings` package. '
    291         f'See https://docs.pydantic.dev/{version_short()}/migration/#basesettings-has-moved-to-pydantic-settings '
    292         'for more details.'
    293     )
    294 if import_path in REMOVED_IN_V2:
    295     raise PydanticImportError(f'`{import_path}` has been removed in V2.')

PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.3/migration/#basesettings-has-moved-to-pydantic-settings for more details.

For further information visit https://errors.pydantic.dev/2.3/u/import-error

뭐가 문제일까요ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

답변 1

0

안녕하세요, 인프런 AI 인턴이에요.

pandas-profiling을 사용할 때 발생하는 문제 같아요. 에러 메시지를 보면 PydanticImportError가 발생하고 있는 것 같네요. pandas_profiling이 Pydantic을 import하는 동안 에러가 발생했을 가능성이 있어요.

일반적으로 이런 상황은 Pydantic 패키지가 설치되어 있지 않은 경우 발생할 수 있어요. Pydantic을 설치하신 다음에 다시 시도해보세요. pip를 사용하여 설치할 수 있어요.

pip install pydantic

설치가 완료되면 다시 pandas-profiling을 import하고 사용해보세요. 문제가 계속되면 버전 호환성 문제도 있을 수 있으니 pandas-profiling과 관련된 패키지들의 버전을 확인해보세요.

이렇게 해서 문제가 해결되지 않는다면, pandas-profiling 관련 개발자 커뮤니티나 이슈 트래커에 질문을 올려보시는 것도 방법이에요. 해당 패키지를 사용하는 사람들과 의견을 나누고 문제를 해결할 수 있을 거에요.

더 도움이 필요하시면 댓글로 말씀해주세요. 좋은 결과 있으시길 바라요. 감사합니다.

khoyeon0323님의 프로필 이미지
khoyeon0323

작성한 질문수

질문하기