본문 바로가기
Python with AI

DataFrame.info() got an unexpected keyword argument 'null_counts' || Deprecated argument - null_counts

by Oliver J 2023. 8. 21.
반응형

한 줄 요약(Long story short~!) : DataFrame.info(null_counts=True) ==> DataFrame.info(show_counts=True) 

 

 

Pandas를 설치한 이후로 업데이트 없이 지속적으로 사용을 하다 보니 아래와 같이 잘 사용하고 있었는데....

Since installing Pandas(The old version), I didn't update it.

null_counts 사용 Sample Image

 

Pandas를 2.0.3으로 업데이트 한 뒤로는 null_counts 인자가 먹히질 않았다..

However, null_counts argument didn't work after updating Pandas. 

unexpected keyword argument 'null_counts'

반응형

해당 Pandas document에 들어가서 확인해 본 결과(version 1.2.0 에는 Deprecated 되어 있다고 아래와 같이 나오지만 두 인자가 존재)

After checking the Pandas document

Pandas version: 2.0.3? 이후로는 null_counts는 완전히 사라지고 show_counts 만 남아있었다.

There's no null_counts argument after Pandas version 2.0.3(not sure the exact version when the argument has been removed)

 

간단하게 null_counts 대신 show_counts로만 변경하면 통과~

Simply changing the argument to show_counts from null_counts~

show_counts Sample Image

 

Python 라이브러리 제작자분들은 버젼을 업그레이드할 때, 함수명, 인자, 또는 사용방법을 탈바꿈해 놓는 경우가 종종 있어서 해당 document에 직접 들어가 보거나 아래와 같이 설치된 라이브러리 패키지를 직접 타고 들어가서 찾아야 하는 경우가 의외로 많은 것 같다.

There're some cases in which the library's arguments, parameters, and usages changed although it was stated in the document prior. You may need to check the document precisely or dig into the library that is installed on your laptop.

(pandas 2.0.3 documentation:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.info.html)

Pandas >> __init__.py >> frame.py

 

728x90
반응형