title: Find non overlapping area between two kde plots in python
body: <p>I was attempting to determine whether a feature is important or not base on its kde distribution for target variable. I am aware how to plot the kde plot and guess after looking at the plots, but is there a more formal doing this? Such as can we calculate the area of non overlapping area between two curves?</p>
  
  <p>When I googled for the area between two curves there are many many links but none of them could solve my exact problem.</p>
  
  <p><strong>NOTE:</strong><br>
  The main aim of this plot is to find whether the feature is important or not. So, please suggest me further if I am missing any hidden concepts here.</p>
  
  <p>What I am trying to do is set some threshold such as 0.2, if the <code>non-overlapping area &gt; 0.2</code>, then assert that the feature is important, otherwise not.</p>
  
  <p>MWE:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import seaborn as sns
  import matplotlib.pyplot as plt
  
  df = sns.load_dataset('titanic')
  
  x0 = df.loc[df['survived']==0,'fare']
  x1 = df.loc[df['survived']==1,'fare']
  
  sns.kdeplot(x0,shade=1)
  sns.kdeplot(x1,shade=1)
  
  </code></pre>
  
  <h1>Output</h1>
  
  <p><a href="https://i.stack.imgur.com/Z1v2d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Z1v2d.png" alt="enter image description here"></a></p>
  
  <h1>Similar links</h1>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/53574569/fill-area-of-overlap-between-two-normal-distributions-in-seaborn-matplotlib">Fill area of overlap between two normal distributions in seaborn / matplotlib</a></li>
  <li><a href="https://stackoverflow.com/questions/29244352/python-overlap-between-two-functions-pdf-of-kde-and-normal">Python: Overlap between two functions (PDF of kde and normal)</a></li>
  <li><a href="https://stackoverflow.com/questions/57969088/fill-area-between-two-curves-in-python">Fill area between two curves in python</a></li>
  </ul>