title: ValueError: Length mismatch: Expected axis has X elements, new values have Y elements
body: <p>I try to fill missing value with the most appeared one in its group .
  <strong>Code</strong> :</p>
  <pre><code>f = lambda x: x.mode().iat[0] if x.notna().any() else np.nan
  s = df.groupby('VehicleType')['FuelType'].transform(f)
  df['FuelType']=df['FuelType'].fillna(s)
  </code></pre>
  <p><strong>Error:</strong> <code>ValueError: Length mismatch: Expected axis has 316879 elements, new values have 354369 elements</code></p>
  <p><strong>Data sample :</strong><a href="https://i.stack.imgur.com/R2seQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R2seQ.png" alt="enter image description here" /></a></p>
  <p><strong>Possible solutions</strong>: I think that maybe the VehicleType data has missing values, therefore it gives an error .Because when I use another column that has no missing values, it works. But I have to use VehicleType for this task .</p>