title: Python: Count Distinct User IDs that share the same email - Pandas Data Manipulation
body: <p>I want to return a dataframe that only shows rows where a <strong>User_ID</strong> has more than 1 Email associated to it. In other words, I am trying to count how many distinct User Ids there are that share an email - See below</p>
  <p><strong>Sample Data</strong></p>
  <pre><code>   Unnamed: 0    First Name  ... User_ID                      Email
  0           0           Bob  ...             2011              Bob@email
  1           1          Dirk  ...             2012              jack@email
  2           2         Sarah  ...             2013              Sara@email
  3           3           max  ...             2015              Bob@email
  4           4           leo  ...             2016              Sara@email
  </code></pre>
  <p>From the table above, my desired outcome would be something like this (note I would drop Value Counts less than 0 as I am only interested in User IDs that have</p>
  <p><strong>Output</strong></p>
  <pre><code>User_ID   (Count of other User_Ids with same Domain) 
  2011       1 
  2012       0 
  2013       1      
  2015       1
  2016       1
  </code></pre>
  <p>In SQL, this would work something like below where I would get output of all user IDs having greater than a count of 1 distinct associated emails. Can someone advise how i can do sonmething similar in python?</p>
  <pre><code>SELECT User_ID, COUNT(EMAILS) AS Count
  FROM dataframe
  HAVING Count &gt; 1
  </code></pre>
  <p>In python I tried to do the following leveraging the value_counts function but dont know how to make it output the desired output above</p>
  <pre><code>df = pd.read_csv(&quot;data.csv&quot;)
  #print( df['Email'].value_counts() &gt; 1)
  emailList = list(df[&quot;Email&quot;].value_counts())
   
  duplicates = df[df['Email'].duplicated(keep=False)]
  print(duplicates.value_counts())
  </code></pre>