Find Last Row in Dataframe: Python pandas module
<p>I'm trying to compare a <code>list</code> and a <code>dataframe</code>. If an <code>item</code> in the <code>list</code> equals a value from the first column in the <code>dataframe's row</code>, I would like to print out that <code>list's item</code> with the <code>dataframe's second column</code> value after it.</p>

<p>If no <code>items</code> in the <code>list</code> match any <code>items</code> in the <code>dataframe's</code> second column, I would like to just print out the <code>list's item</code>. I thought a good way to go about this is to iterate through the whole <code>list</code> and <code>dataframe</code>, and if we get to the last row of the <code>dataframe</code> and non of the items match, print out just the <code>list's item</code> instead of the <code>list's item</code> plus the <code>dataframe's second column</code>. </p>

<p>What I need help with is determining the syntax needed to find the last row in the dataframe. Please see my code below. </p>

<p>The dataframe I'm using is <code>1003 rows X 2 columns</code>. The row labels are numbers <code>0-1002</code>. The column labels are <code>col1</code> and <code>col2</code></p>

<pre><code>#compare items from List against items from dataframe to find matches
for item in List:
    for idx, row in df.iterrows():
        if item in row['col1']:
            print str(count) + " " + str(item) + " " + str(row['col2'])
            count=count+1

        #if it's the last row in dataframe:
            if item not in row['col1']:
                print str(count) + " " + str(item) 
</code></pre>