title: Hausdorff distance for large dataset in a fastest way
body: <p>Number of rows in my dataset is 500000+. I need Hausdorff distance of every <code>id</code> between itself and others. and repeat it for the whole dataset</p>
  
  <p>I have a huge data set. Here is the small part:</p>
  
  <pre><code>df = 
  
  id_easy ordinal latitude    longitude            epoch  day_of_week
  0   aaa     1.0  22.0701       2.6685   01-01-11 07:45       Friday
  1   aaa     2.0  22.0716       2.6695   01-01-11 07:45       Friday
  2   aaa     3.0  22.0722       2.6696   01-01-11 07:46       Friday
  3   bbb     1.0  22.1166       2.6898   01-01-11 07:58       Friday
  4   bbb     2.0  22.1162       2.6951   01-01-11 07:59       Friday
  5   ccc     1.0  22.1166       2.6898   01-01-11 07:58       Friday
  6   ccc     2.0  22.1162       2.6951   01-01-11 07:59       Friday
  </code></pre>
  
  <p>I want to calculate <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.directed_hausdorff.html" rel="noreferrer">Haudorff Distance</a>:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  from scipy.spatial.distance import directed_hausdorff
  from scipy.spatial.distance import pdist, squareform
  
  u = np.array([(2.6685,22.0701),(2.6695,22.0716),(2.6696,22.0722)]) # coordinates of `id_easy` of taxi `aaa`
  v = np.array([(2.6898,22.1166),(2.6951,22.1162)]) # coordinates of `id_easy` of taxi `bbb`
  directed_hausdorff(u, v)[0]
  </code></pre>
  
  <p>Output is <code>0.05114626086039758</code></p>
  
  <hr>
  
  <p>Now I want to calculate this distance for the whole dataset. For all <code>id_easy</code>s. Desired output is matrix with <code>0</code> on diagonal (because distance between the <code>aaa</code> and <code>aaa</code> is <code>0</code>):</p>
  
  <pre><code>     aaa      bbb    ccc
  aaa    0  0.05114   ...
  bbb    ...   0
  ccc             0
  </code></pre>