I have pandas DataFrame df
with different types of columns, some values of df
are NaN.
To test some assumption, I create copy of df
, and transform copied df to (0, 1) with pandas.isnull():
df_copy = df
for column in df_copy:
df_copy[column] = df_copy[column].isnull().astype(int)
but after that BOTH df
and df_copy
consist of 0 and 1.
Why this code transforms df
to 0, 1 and is there way to prevent it?