title: How to find area between density plots in python?
body: <p>I was reading a blog about Feature Selection based on the density curves of the features. The blog is in R language and I am not familiar with that.</p>
  
  <p>Blog:<br>
  - <a href="https://myabakhova.blogspot.com/2016/02/computing-ratio-of-areas.html" rel="nofollow noreferrer">https://myabakhova.blogspot.com/2016/02/computing-ratio-of-areas.html</a><br>
  - <a href="https://www.datasciencecentral.com/profiles/blogs/choosing-features-for-random-forests-algorithm" rel="nofollow noreferrer">https://www.datasciencecentral.com/profiles/blogs/choosing-features-for-random-forests-algorithm</a></p>
  
  <p>The blog says if the density curves of two features are significantly different (look below the equation, which says > 0.75), then we can discard one of the features. </p>
  
  <p>Now, I am familiar with how to plot density curves, but not sure how to get the intersection area. Any help with finding the intersection area is greatly appreciated.</p>
  
  <p>Here is my attempt:</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import pandas as pd
  import seaborn as sns
  from sklearn.preprocessing import MinMaxScaler
  
  df = sns.load_dataset('iris').drop('species',axis=1)
  
  # normalize data
  x = df.to_numpy()
  min_max_scaler = MinMaxScaler()
  x_scaled = min_max_scaler.fit_transform(x)
  df = pd.DataFrame(x_scaled)
  
  # density plots
  x1 = df[0]
  x2 = df[1]
  sns.distplot(x1)
  sns.distplot(x2)
  
  Now, I don't know how to find the area under two separate curves and intersection area.
  </code></pre>
  
  <h1>Question</h1>
  
  <ol>
  <li>How to find the area under each curve?  </li>
  <li>How to find the area of overlapping section?  </li>
  <li>Do we need to scale features (sepal or petal length to 0 to 1)?</li>
  </ol>
  
  <h1>My output</h1>
  
  <p><a href="https://i.stack.imgur.com/Cl9Tv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cl9Tv.png" alt="enter image description here"></a></p>
  
  <h1>For reference, the blog density curves look like this</h1>
  
  <p><a href="https://i.stack.imgur.com/fnJ2c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fnJ2c.png" alt="enter image description here"></a></p>