Plot NaNs as a category seaborn countplot

I have a column in my dataframe which has 'True' as a value and all other values are NaNs (so there are no 'false' values). I want to plot a countplot for the said data in seaborn but want to include the NaNs as well. Basically, I want to convert the NaNs to 'false' values and plot a graph then but I dont want to make any changes to my original column. Is there a way I can create a separate category for NaNs as False category and plot it alongside the True category?

Topic plotting seaborn python

Category Data Science


Yes, you can make a copy of your dataframe to a new dataframe and then apply the conversion from NaN to false as follows:

df2 = df.copy()

df2['column'] = df2['column'].fillna(False)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.