title: How to select unique values of column A in each group B and get sum of values in column C for these unique values
body: <p>I have posts dataframe and authors dataframe</p>
  <p>I need to calculate favCount of the authors of posts in each day</p>
  <pre><code>    posts_columns = [&quot;postId&quot;, &quot;authorId&quot;, &quot;date&quot;]
      posts = [(&quot;1&quot;, &quot;1&quot;, &quot;2020-10-10&quot;),
               (&quot;2&quot;, &quot;2&quot;, &quot;2020-10-10&quot;),
               (&quot;3&quot;, &quot;2&quot;, &quot;2020-10-10&quot;),
               (&quot;4&quot;, &quot;2&quot;, &quot;2020-10-11&quot;)
               (&quot;5&quot;, &quot;3&quot;, &quot;2020-10-11&quot;)
               (&quot;6&quot;, &quot;3&quot;, &quot;2020-10-11&quot;)]
  
      authors_columns = [&quot;authorId&quot;, &quot;favCount&quot;]
      authors = [
          (&quot;1&quot;, &quot;5&quot;),
          (&quot;2&quot;, &quot;3&quot;),
          (&quot;3&quot;, &quot;12&quot;)]
  </code></pre>
  <p>After (inner) joining Posts and Authors dataframes on (posts.authorId=author.authorId) and I got this</p>
  <pre><code>+----------+--------+---------------+                                  
  |      date|authorId|       favCount|
  +----------+--------+---------------+
  |2020-10-10|       1|              5|
  |2020-10-10|       2|              3|
  |2020-10-10|       2|              3|
  |2020-10-11|       2|              3|
  |2020-10-11|       3|             12|
  |2020-10-11|       3|             12|
  +----------+--------+---------------+
  </code></pre>
  <p>Now I want to calculate sum of favCount of authors in each day, the final result should be like this</p>
  <pre><code>+----------+-------------+                                  
  |      date|sum(favCount)|
  +----------+-------------+
  |2020-10-10|            8|
  |2020-10-11|           15|
  +----------+-------------+
  </code></pre>
  <p>On OCT, 10th I have two authors (1 and 2) with total of 8 favCount (5+3)</p>
  <p>On OCT, 11th I have two authors (2 and 3) with total of 15 favCount (3+12)</p>
  <p>P.S: I don't want to count favCount for duplicated authors, favCount for each author should be counted once only in each day</p>
  <p>P.S(2): I'm using PySpark and Dataframes but I don't mind answers in Pandas or even SQL</p>