Python - Invalid Syntax for simple if/else statement : <p>I am using a very simple if/else statement within a for loop and I keep getting invalid syntax. All the indenting is correct. </p>

<p>I have a pandas dataframe with 2 columns. One column is a string of times in the form of mm:ss and I want to convert this to seconds. This column also has some NaN values. The second column is true/false determining if the first column is NaN.</p>

<pre><code>temp = []
temp_dF = pd.concat([data["Reading Time"], pd.isnull(data["Reading Time"])], axis=1)

for row in temp_dF.itertuples(index=False):

    if row[1] == False:
        sec = int(float(row[0][:2]) * 60 + int(float(row[0][-2:]))
    else:
        sec = None

    temp.append(sec)

data["Reading Time"] = temp
</code></pre>

<p>Here is the error:</p>

<pre><code>  File "&lt;ipython-input-23-e06720dbae3c&gt;", line 8
    else:
       ^
SyntaxError: invalid syntax
</code></pre>
