title: problems with python lists and columns
body: <p>Hello I have the following code, where in the &quot;filter&quot; part, I filter a program by channel and year, and with group by I make the average per day of the column where the rating comes from.</p>
  <pre><code>año=[2019,2020]
  base2= dataframe
  channels=[lista con canales]
  
  def ran_diario(base2,año,channels):
  
  lista=[]
  df = pd.DataFrame()
  
  for h in año:
      for i in range(1,53):
          filtro=base2[base2.Year.isin([h]) &amp; base2.Channel.isin(channels) &amp; base2.Week.isin([i])]  
          filtro = filtro[filtro['Description'].str.contains('[a-z]*|[a-z]*'.join(word),case=False)]
          filtro[&quot;Date&quot;] = pd.to_datetime(filtro[&quot;Date&quot;])      
          a=filtro.groupby(&quot;Date&quot;, as_index=False)[targets].mean()
          lista.append(a)
          df[&quot;Year&quot;]=h
          df[&quot;Week&quot;]=i
          df=df.append(lista,ignore_index=True)
      
  return (df)
  </code></pre>
  <p>the output I get is:</p>
  <pre><code>      Year  Week      Date              rat %
  0   2020.0  52.0 2018-12-31            0.000000
  1   2020.0  52.0 2019-01-01            0.000000
  2   2020.0  52.0 2019-01-02            0.000000
  3   2020.0  52.0 2019-01-03            0.000000
  4   2020.0  52.0 2019-01-04            0.130000
  ..     ...   ...        ...                 ...
  1      NaN   NaN 2020-01-12            0.000000
  0      NaN   NaN 2020-02-01            0.066667
  0      NaN   NaN 2020-02-08            0.000000
  0      NaN   NaN 2020-02-15            0.035000
  0      NaN   NaN 2020-02-29            0.000000
  </code></pre>
  <p>As you can see, the date and rat% column are fine but the year column puts me at the beginning of the year 2020 when it is 2019 and in the week that goes according to the i of the for it only puts the last one which is 52 and in the data of &quot; date &quot;for 2020 fill them with NaN The output should be:</p>
  <pre><code>     Year  Week       Date           rat %
  0   2019.0   1.0 2018-12-31            0.000000
  1   2019.0   2.0 2019-01-01            0.000000
  2   2019.0   3.0 2019-01-02            0.000000
  3   2019.0   4.0 2019-01-03            0.000000
  4   2019.0   5.0 2019-01-04            0.130000
  ..     ...   ...        ...                 ...
  1   2020.0   1.0 2020-01-12            0.000000
  0   2020.0   2.0 2020-02-01            0.066667
  0   2020.0   3.0 2020-02-08            0.000000
  0   2020.0   4.0 2020-02-15            0.035000
  0   2020.0   5.0 2020-02-29            0.000000
  </code></pre>