I am trying to label a row if they are exist in a dataframe. Here is a snippet of my code:
MissingAATracking = []
for row in UK.UK:
if row in links_adobe_uk:
MissingAATracking.append("NO")
else:
MissingAATracking.append("YES")
I get the following error:
> --------------------------------------------------------------------------- TypeError Traceback (most recent call
> last) <ipython-input-94-5b85f0a628ec> in <module>()
> 1 for row in UK.UK:
> ----> 2 if row in links_adobe_uk:
> 3 MissingAATracking.append("NO")
> 4 else:
> 5 MissingAATracking.append("YES")
>
> /anaconda/lib/python3.6/site-packages/pandas/core/generic.py in
> __contains__(self, key)
> 905 def __contains__(self, key):
> 906 """True if the key is in the info axis"""
> --> 907 return key in self._info_axis
> 908
> 909 @property
>
> /anaconda/lib/python3.6/site-packages/pandas/core/indexes/base.py in
> __contains__(self, key) 1588 @Appender(_index_shared_docs['__contains__'] % _index_doc_kwargs)
> 1589 def __contains__(self, key):
> -> 1590 hash(key) 1591 try: 1592 return key in self._engine
>
> TypeError: unhashable type: 'list'
I have looked here: Python, TypeError: unhashable type: 'list'
UPDATE
Here is what the head of my UK dataframe looks like:
UK
0 Link1
1 Link1
2 Link1
3 Link1
4 Link1
and my links_adobe_uk:
PageURL
0 (null)
1 Link1
2 Link1
3 Link1
4 Link1
I have also tried to drop duplicates from both columns but my UK dataframe throws a
TypeError: unhashable type: 'list'
but I cant seem to follow as Both UK and links_adobe_uk are both dataframes. I will appreciate guidance on this