title: The axis argument to unique is not supported for dtype object
body: <p>I am trying to get unique counts column-wise but my array has categorical variables (dtype object)</p>
  
  <pre><code>val, count = np.unique(x, axis=1, return_counts=True)
  </code></pre>
  
  <p>Though I am getting an error like this:</p>
  
  <pre><code>TypeError: The axis argument to unique is not supported for dtype object
  </code></pre>
  
  <p>How do I sove this problem?</p>
  
  <p>Sample x:</p>
  
  <pre><code>array([[' Private', ' HS-grad', ' Divorced'],
         [' Private', ' 11th', ' Married-civ-spouse'],
         [' Private', ' Bachelors', ' Married-civ-spouse'],
         [' Private', ' Masters', ' Married-civ-spouse'],
         [' Private', ' 9th', ' Married-spouse-absent'],
         [' Self-emp-not-inc', ' HS-grad', ' Married-civ-spouse'],
         [' Private', ' Masters', ' Never-married'],
         [' Private', ' Bachelors', ' Married-civ-spouse'],
         [' Private', ' Some-college', ' Married-civ-spouse']], dtype=object)
  </code></pre>
  
  <p>Need the following counts:</p>
  
  <pre><code>for x_T in x.T:
      val, count = np.unique(x_T, return_counts=True)
      print (val,count)
  
  
  [' Private' ' Self-emp-not-inc'] [8 1]
  [' 11th' ' 9th' ' Bachelors' ' HS-grad' ' Masters' ' Some-college'] [1 1 2 2 2 1]
  [' Divorced' ' Married-civ-spouse' ' Married-spouse-absent'
   ' Never-married'] [1 6 1 1]
  </code></pre>