Package: clean-df
clean_dfPython module to report, clean, and optimizePandas Dataframeseffectively.Full DocumentationHere.Description and FeaturesThe first step of any data analysis project is to check and clean the data, in this module I implemented a very effiecint code that can:Automatically drop columns that have a unique value (these columns are useless, so it will be dropped).Report yourPandas DataFrameto decide for actions, this report will show:Duplicated rows report.Columnsâ€™ Datatype to optimize memory report.Columns to convert to categorical report.Outliers report.Missing values report.Clean the dataframe by dropping columns that have a high ratio of missing values, rows with missing values, and duplicated rows in the dataframe.Optimize the dataframe by converting columns to the desired data type and converting categorical columns to ‘category’ data type.InstallationTo installclean_df, run this command in your terminal:$ pip install clean_dfFor more information on installation details for this project, please see thedocs/installation.rstfile.UsageThis module is very easy to use, for a full detailed example please see thedocs/usage.rstfile.Importing the modulefrom clean_df import CleanDataFrameDefining the classPass your pandas dataframe toCleanDataFrameclass:cdf = CleanDataFrame(
        df=df,             # the dataframe to be cleaned
        max_num_cat=5      # maximum number of unique values in a column to be
        )                  # converted to categorical datatype, default is 5ReportingCallreportmethod to see a full report about the dataframe (duplications, columns to optimize its data types, categorical columns, outliers, and missing values:cdf.report(
        show_matrix=True,   # show matrix missing values (from missingno package), default is True
        show_heat=True,     # show heat missing values (from missingno package), default is True
        matrix_kws={},      # if need to pass any arguments to matrix plot, default is {}
        heat_kws={}         # if need to pass any arguments to heat plot, default is {}
        )CleaningCallcleanmethod to drop high number of missing value columns, duplicated rows, and rows with missing values:cdf.clean(
        min_missing_ratio=0.05,    # the minimum ratio of missing values to drop a column, default is 0.05
        drop_nan=True              # if True, drop the rows with missing values after dropping columns
                                   # with missingsa above min_missing_ratio
        drop_kws={},               # if need to pass any arguments to pd.DataFrame.drop(), default is {}
        drop_duplicates_kws={}     # same drop_kws, but for drop_duplicates function
        )OptimizingCalloptimizemethod to optimize the dataframe by changing columns’ data types based on its values for maximum memory savings:cdf.optimize()Accessing the Cleaned Data DataFramecdf.dfContributingSee theCONTRIBUTING.rstfor contribution details. Feel free to contact me for any subject through my:EmailLinkedInWhatsAppAlso, you are welcomed to visit my personalblog.LicenseFree software: MIT license.DocumentationThe full documentation is hosted on mywebsite, and onReadTheDocs.The source code is available inGitHub.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.Here areadditionalresources I got a lot from them.History0.3.0 (2023-08-23)Improve the performance when callingreportmethod.Thepytestnow is including the full methods in the module.0.2.3 (2023-03-04)Improve memory consumption and module performance.0.2.2 (2023-03-03)Fix a bug that made “dict_keys” error in some speical cases.0.2.1 (2023-03-03)Improve module performance.0.2.0 (2023-03-02)Add a new report for categorical columns.Make the module more efficient.0.1.1 (2023-02-27)Rectify and organize documentation.Provide test to GitHub Actions.0.1.0 (2023-02-27)First release on PyPI.