title: Stuck with TypeError: Cannot compare types 'ndarray(dtype=object)' and 'str'
body: <p>I have field stored as object in my df, and I'm trying to replace low frequency values with 'other' with the following code:</p>
  
  <pre><code>cols = ['Keyword']
  
  for col in cols:
      val = df_ch[col].value_counts()
      y = val[val &lt; 10000].index
  
  df_ch[col] = df_ch[col].replace({x:'other' for x in y})
  </code></pre>
  
  <p>But I'm keeping having this error:</p>
  
  <pre><code>TypeError: Cannot compare types 'ndarray(dtype=object)' and 'str'
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>This is how the filed looks like:</p>
  
  <pre><code>df_ch['Keyword'].head(20)
  Out[55]: 
  0                 (not provie)
  1                 (not provie)
  2                    (not set)
  3                    (not set)
  4                 (not provie)
  5                 (not provie)
  6                    (not set)
  7                    (not set)
  8                     keyword1
  9                 (not provie)
  10                   (not set)
  11                   (not set)
  12                (not provie)
  13                (not provie)
  14                   (not set)
  15                (not provie)
  16                (not provie)
  17                     display
  18                (not provie)
  19                (not provie)
  Name: Keyword, dtype: object
  </code></pre>