I have two different dataframes which I am trying to compare. So, my first data frame has 10 rows and the second has 2,000. What I'm trying to do is compare the first row in my first df to all 2,000 in the other df. Then do the same for the next row in my first df.
Here is the code I have currently. It works fine through the first 2,000, then when i should be incremented it crashes.
i = 1
j = 1
for u in userFrame.iterrows():
for d in dbFrame.iterrows():
if userFrame['tag'][i] == dbFrame['tag1'][j]:
print('Found one!:' + userFrame['tag'][i])
j += 1
i += 1
Edit: here are the errors I'm getting:
File "C:\Users\david\Desktop\CC Project\test.py", line 158, in Analyze
if userFrame['tag'][i] == dbFrame['tag1'][j]:
File "C:\Python34\lib\site-packages\pandas\core\series.py", line 557, in __getitem__
result = self.index.get_value(self, key)
File "C:\Python34\lib\site-packages\pandas\core\index.py", line 1790, in get_value
return self._engine.get_value(s, k)
File "pandas\index.pyx", line 103, in pandas.index.IndexEngine.get_value (pandas\index.c:3204)
File "pandas\index.pyx", line 111, in pandas.index.IndexEngine.get_value (pandas\index.c:2903)
File "pandas\index.pyx", line 157, in pandas.index.IndexEngine.get_loc (pandas\index.c:3843)
File "pandas\hashtable.pyx", line 303, in pandas.hashtable.Int64HashTable.get_item (pandas\hashtable.c:6525)
File "pandas\hashtable.pyx", line 309, in pandas.hashtable.Int64HashTable.get_item (pandas\hashtable.c:6463)
KeyError: 1644