Created
July 25, 2025 11:16
-
-
Save adwiteeya3/59cc61c18bf8ed954322ca47edb63e08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Detailed Missing Values Report | |
| def missing_data_report(df): | |
| total = df.isnull().sum().sort_values(ascending=False) | |
| percent = (df.isnull().sum()/df.isnull().count()*100).sort_values(ascending=False) | |
| missing_df = pd.concat([total, percent], axis=1, keys=['Total Missing', 'Percent Missing (%)']) | |
| return missing_df[missing_df['Total Missing'] > 0] | |
| print("\nMissing Data Report:") | |
| print(missing_data_report(df)) | |
| # Visualizing Missing Data Patterns (Seaborn) | |
| plt.figure(figsize=(10, 6)) | |
| sns.heatmap(df.isnull(), cbar=False, cmap='viridis') | |
| plt.title('Missing Values Heatmap') | |
| plt.show() | |
| # You can also use missingno library for more advanced missing data visualizations | |
| # !pip install missingno | |
| # import missingno as msno | |
| # msno.matrix(df, figsize=(10, 6), color=(0.2, 0.2, 0.2)) | |
| # plt.title('Missing Values Matrix (missingno)') | |
| # plt.show() | |
| # msno.bar(df, figsize=(10, 6), color='skyblue') | |
| # plt.title('Missing Values Bar Plot (missingno)') | |
| # plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment