Skip to content
FacebookTwitterLinkedinYouTubeGitHubSubscribeEmailRSS
Close
Beyond Knowledge Innovation

Beyond Knowledge Innovation

Where Data Unveils Possibilities

  • Home
  • AI & ML Insights
  • Machine Learning
    • Supervised Learning
      • Introduction
      • Regression
      • Classification
    • Unsupervised Learning
      • Introduction
      • Clustering
      • Association
      • Dimensionality Reduction
    • Reinforcement Learning
    • Generative AI
  • Knowledge Base
    • Introduction To Python
    • Introduction To Data
    • Introduction to EDA
  • References
HomeImplementationEDACDF plot of Numerical columns
EDA Python

CDF plot of Numerical columns

March 12, 2024March 12, 2024CEO 178 views

The provided code below generates a grid of subplots (dynamic rows and 2 columns) and plots cumulative distribution function (CDF) plots for numerical variables in a DataFrame (df).

num_col = df.select_dtypes(include=np.number).columns.to_list()
col_count = len(num_col)

fig_rows = (col_count // 2 ) + 1 if col_count % 2 != 0 else col_count //2

fig, axes = plt.subplots(fig_rows, 2, figsize=(20, 15))
fig.suptitle("CDF plot of numerical variables", fontsize=20)
counter = 0
for i in range(fig_rows):
    sns.ecdfplot(ax=axes[i][0], x=df[num_col[counter]])
    counter = counter + 1
    if counter != col_count:
        sns.ecdfplot(ax=axes[i][1], x=df[num_col[counter]])
        counter = counter + 1
    else:
        pass

fig.tight_layout(pad=2.0)
cdf, ecdfplot, python, subplots

Post navigation

Previous Post
Previous post: Finding the optimal number of clusters (k) using Elbow Method
Next Post
Next post: Single linkage hierarchical clustering

You Might Also Like

No image
Delete a folder in Google Colab
June 20, 2024 Comments Off on Delete a folder in Google Colab
No image
Python warnings module
March 3, 2024 Comments Off on Python warnings module
No image
How-to: give a specific sorting order to…
February 7, 2024 Comments Off on How-to: give a specific sorting order to categorical values
No image
How-to: When missing data is of type…
February 6, 2024 Comments Off on How-to: When missing data is of type categorical
No image
How-to: clean a dataset
February 6, 2024 Comments Off on How-to: clean a dataset
  • Recent
  • Popular
  • Random
  • No image
    7 months ago Low-Rank Factorization
  • No image
    7 months ago Perturbation Test for a Regression Model
  • No image
    7 months ago Calibration Curve for Classification Models
  • No image
    March 15, 20240Single linkage hierarchical clustering
  • No image
    April 17, 20240XGBoost (eXtreme Gradient Boosting)
  • No image
    April 17, 20240Gradient Boosting
  • No image
    March 7, 2024Python scikit-learn library for Decision Tree model
  • No image
    March 11, 2024Finding the optimal number of clusters (k)…
  • No image
    February 11, 2024How-to: save a Google Colab notebook as…
  • Implementation (55)
    • EDA (4)
    • Neural Networks (10)
    • Supervised Learning (26)
      • Classification (17)
      • Linear Regression (8)
    • Unsupervised Learning (11)
      • Clustering (8)
      • Dimensionality Reduction (3)
  • Knowledge Base (44)
    • Python (27)
    • Statistics (6)
May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Oct    

We are on

FacebookTwitterLinkedinYouTubeGitHubSubscribeEmailRSS

Subscribe

© 2025 Beyond Knowledge Innovation
FacebookTwitterLinkedinYouTubeGitHubSubscribeEmailRSS