I am getting error KeyError: 'duration' when it exists : <p>The following code returns error </p>

<pre><code>KeyError: 'duration'


for i in range(0, 3): 
     exam_df['duration'] = pd.to_datetime(i,(exam_df['Duration '])[i])
exam_df['grade'] = exam_df['Grade'].astype(np.int64)
exam_df.plot.scatter(x='duration', y='grade')
</code></pre>
