title: Imputate Nan for categorical data depending on its "Type" column
body: <p>I have dataframe with 2 columns Name and Signal. I want to fill nan values in Signal column but it should be done according to its Name. I want to imputate it with Most frequent value according to its Name. For example:</p>
  <pre><code>Timestamp   Name  Signal
   2021-01-01  A.     On
   2021-01-02. A      nan
   2021-01-03. A.     On 
   2021-01-01. B.     Off
   2021-01-02. B.     Off
   2021-01-03. B.     nan
  </code></pre>
  <p>For name A nan value of Signal column should be imputated with &quot;On&quot; since it is most frequent value but for Name B it should be filled with Off because it is the most frequent for B.</p>
  <p>How can I achieve it?</p>