title: Looking for smarter way to handle multiple version of a value in Python Pandas dataframe
body: <p>I am working on Python data manipulation, and have a column with a variety of values that represent same value.</p>
  <p><a href="https://i.stack.imgur.com/nPfbm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nPfbm.png" alt="enter image description here" /></a></p>
  <p>I did checked the uniques values and they are as
  array(['Male', 'male', 'm', 'FEMALE', 'female', 'F', 'M', 'Female'],       dtype=object)</p>
  <p>Please suggest how can i replace it to one version.</p>
  <p>Below is the code I did try, but there are more such fields, so <strong>looking for smart way.</strong></p>
  <pre><code>df['Gender'] = df['Gender'].replace(to_replace =[&quot;Male&quot;, &quot;male&quot;, &quot;m&quot;, &quot;M&quot;], value =&quot;Male&quot;)
  #similar code for Female value.
  </code></pre>
  <p>Another approach I am using is</p>
  <pre><code>df['Gender'] = np.where(df['Gender'].str.lower() == 'male', 'Male', df.Gender)
  df['Gender'] = np.where(df['Gender'].str.lower() == 'm', 'Male', df.Gender)
  df['Gender'] = np.where(df['Gender'].str.lower() == 'female', 'Female', df.Gender)
  df['Gender'] = np.where(df['Gender'].str.lower() == 'f', 'Female', df.Gender)
  </code></pre>