Pandas - NaN is a float

 

현상

When I concate or merge, some columns are forced to change to Float64


원인

In Working with missing data, we saw that pandas primarily uses NaN to represent missing data. Because NaN is a float, this forces an array of integers with any missing values to become floating point. In some cases, this may not matter much. But if your integer column is, say, an identifier, casting to float can be problematic. Some integers cannot even be represented as floating point numbers.


해결

astype('Int64') 임의변경

이 블로그의 인기 게시물

반올림 올림 내림 버림(절사) 차이와 구현방법

MSSQL SP에서 외부 DLL 사용하는 방법 (CLR 확장저장프로시저)

럭스 원종희 인터뷰 (펌)