How to loop through a Pandas dataframe
<p>I am trying to loop through a Pandas dataframe.  The list <code>L</code> includes values that are used to specify what row <code>X</code> or <code>Y</code> should begin from i.e., (1:, 2:, 3:).</p>

<pre><code>list = [1,2,3]

for L in list:
    X = data.ix[L:, 'X':]
    Y = data.ix[L:, 'Y']     
    regressor = LinearRegression()
    regressor.fit(X, Y)
    prediction = regressor.predict([[Variable]])
</code></pre>

<p>The error when attempting the above is:</p>

<pre><code>TypeError: 'type' object is not iterable
</code></pre>