title: pandas count frequency of column value in another dataframe column
body: <p>I want to calculate the frequencies of values of a dataframe column in a column from another dataframe. Right now, I have the code as below:</p>
  
  <pre><code>df2["freq"] = df1[["col1"]].groupby(df2["col2"])["col1"].transform('count')
  </code></pre>
  
  <p>But it is giving freq of 1.0 for all the values in df2["col2"], even for those values that don't exist in df1["col1"].</p>
  
  <p>df1:</p>
  
  <pre><code>            col1
  0            636  
  1            636  
  2            801  
  3            802  
  </code></pre>
  
  <p>df2:</p>
  
  <pre><code>            col2
  0            636  
  1            734  
  2            801  
  3            803  
  </code></pre>
  
  <p>df2 after adding freq column:</p>
  
  <pre><code>            col2    freq
  0            636    1.0
  1            734    1.0
  2            801    1.0
  3            803    1.0
  </code></pre>
  
  <p>What I actually want:</p>
  
  <pre><code>            col2    freq
  0            636     2
  1            734     0
  2            801     1
  3            803     0
  </code></pre>
  
  <p>I am new to pandas, so I am not getting what I am doing wrong. Any help is appreciated! Thanks!</p>