a function to create a null matrix in python 1

a function to create a null matrix in python

def plot_null_matrix(df, figsize=(18,15)):    
	# initiate the figure    
	plt.figure(figsize=figsize)    
	# create a boolean dataframe based on whether values are null    
    df_null = df.isnull()    
    # create a heatmap of the boolean dataframe    
    sns.heatmap(~df_null, cbar=False, yticklabels=False)    
    plt.show()

Here is what the above code is Doing:
1. Create a figure with a specific size
2. Create a boolean dataframe based on whether values are null
3. Create a heatmap of the boolean dataframe
4. Show the heatmap

Similar Posts