Data & ML & AI/Pandas & Scikit-Learn

df.profile_report 에러 (typeguard.TypeCheckError: argument "config_file" (None) did not match any element in the union)

뇌님 2023. 10. 17. 12:05
반응형

다른 컴퓨터에서 돌리던 코드를 돌렸는데 profie_report 부분에서 에러가 발생합니다.

 

import pandas as pd

df = pd.read_csv('file.csv', index_col=None)
df.profile_report()

# 결과
Traceback (most recent call last):
...
typeguard.TypeCheckError: argument "config_file" (None) did not match any element in the union:
  pathlib.Path: is not an instance of pathlib.Path
  str: is not an instance of str

에러에서는 config_file이 잘못되었다고 합니다.

하지만

# 대안1
df.profile_report(config_file=None)

# 대안2
from pandas_profiling import ProfileReport
profile_report = ProfileReport(df)

모두 동일한 에러가 도출되었습니다.

 

pip update에 pandas-profiling도 최신인데?

검색해보면 모두 문제 없이 사용하는 것 같은데??

chatGPT한테 물어봐서 나온 답변도 죄다 config_file=None 설정밖에 없고 안되는데?!

 

 

에러 원인

원인에 대한 설명은 오히려 공식문서 사이트에 있었습니다.

 

pandas-profiling

Deprecated 'pandas-profiling' package, use 'ydata-profiling' instead

pypi.org

아 패키지가 대체된다고...
4월 1일까지만 지원하는거였구나...

 

에러 해결

1) pip로 ydata-profiling 설치

pip install ydata-profiling

 

2) import만 추가하고 기존 코드 그대로 이용

import pandas as pd
from ydata_profiling import ProfileReport

df = pd.read_csv('file.csv', index_col=None)
profile_report = ProfileReport(df)

 

문서가 잘 만들어졌습니다.

 


 

반응형