title: ValueError: Buffer has wrong number of dimensions (expected 1, got 2) on if in statement
body: <p>I'm trying to use an "if" statement inside a "for" cycle to check if the index of the current item in the cycle (index of a pandas Series containing the item), corresponds to one of the indexes of another Series, but doing so raises a ValueError.
  This is the line of code which gives problems:</p>
  
  <pre><code>if(ICM_items[ICM_items['track_id'] == i].index[0] in ICM_tgt_items.index.values.flatten().tolist()):
  </code></pre>
  
  <p>I tried changing both sides of the "in" statement with random integers or lists and it works, also the two items are built correctly, but when coupled in the statement they raise an error.</p>
  
  <p>Hope someone can give me some hints on where's the problem or an alternative way to perform the same task.</p>
  
  <p>ICM_items and ICM_tgt_items are both pandas.Series</p>
  
  <p>Below there's the console error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "/Users/LucaButera/git/rschallenge/similarity_to_recommandable_builder.py", line 27, in &lt;module&gt;
  dot[ICM_tgt_items[ICM_items[ICM_items['track_id'] == i].index[0]]] = 0
  File "/Users/LucaButera/anaconda/lib/python3.6/site-packages/pandas/core/series.py", line 603, in __getitem__
  result = self.index.get_value(self, key)
  File "/Users/LucaButera/anaconda/lib/python3.6/site-packages/pandas/indexes/base.py", line 2169, in get_value
  tz=getattr(series.dtype, 'tz', None))
  File "pandas/index.pyx", line 98, in pandas.index.IndexEngine.get_value (pandas/index.c:3557)
  File "pandas/index.pyx", line 106, in pandas.index.IndexEngine.get_value (pandas/index.c:3240)
  File "pandas/index.pyx", line 147, in pandas.index.IndexEngine.get_loc (pandas/index.c:4194)
  File "pandas/index.pyx", line 280, in pandas.index.IndexEngine._ensure_mapping_populated (pandas/index.c:6150)
  File "pandas/src/hashtable_class_helper.pxi", line 446, in pandas.hashtable.Int64HashTable.map_locations (pandas/hashtable.c:9261)
  ValueError: Buffer has wrong number of dimensions (expected 1, got 2)
  [Finished in 1.26s]
  </code></pre>