title: Issue with nested loop and df.append
body: <p>Good morning,</p>
  <p>I have the following dataset (making this up since the main dataset is confidential):</p>
  <pre><code>country     city    total_customer  total_purchase  total_items
  France      Paris     2355231         7848589        84454
  Germany     Berlin    3211551         5646545        84564
  </code></pre>
  <p>I want to run a linear regression for each country and city combination and output it as a final pandas dataframe like the following:</p>
  <pre><code>country     city      coef1           coef2      intercept
  France      Paris     -0.294942     258.471387  -625.582231
  Germany     Berlin    1.987         422.4554     454.645
  </code></pre>
  <p>I wrote the following code so far (my dataset is small like 10k rows maximum so I am not too worried about performance):</p>
  <pre><code>import pandas as pd
  from sklearn import linear_model
  import statsmodels.api as sm
  countries = df[&quot;country&quot;].unique()
  cities = df[&quot;city&quot;].unique()
  df_results = pd.DataFrame([], columns=['country','city','coef1','coef2','intercept'])
  for country in countries:
        for city in cities:
              df[(df['country']== country)&amp;(df['city']== city)]
              y = df[&quot;total_customer&quot;]
              y = y.dropna()
              x = df[[&quot;total_purchase&quot;,&quot;total_items&quot;]]
              x = x.dropna()
              regr = linear_model.LinearRegression()
              if df.empty:
                  continue
              else:
                  regr.fit(x, y)
                  coef1 = regr.coef_[0]
                  coef2 = regr.coef_[1]
                  intercept = regr.intercept_
                  df_results = df_results.append({'country':country,'city':city,'coef1':coef1,'coef2':coef2,'intercept':intercept}, ignore_index=True)
  </code></pre>
  <p>The output is the following:</p>
  <pre><code>df_results
      country  city        coef1       coef2        intercept
  0   France   Paris      -0.294942   258.471387  -625.582231
  1   Germany  Berlin     -0.294942   258.471387  -625.582231
  
  </code></pre>
  <p>It looks like the results for coef1, coef2 and intercept are gonna be a single output instead of the output of each linear regression run and I cannot seem to fix it so if someone could enlighten me here that would be appreciated, thanks!</p>