title: How can Python Pandas fill in an empty column and not count its sum?
body: <p>I am solving a problem in which there is a column with <code>NaN</code> values that need to be filled in by the number of rows, starting from one. Like this:</p>
  <pre><code>       j  П, k=1  П, k=2
  0      1    10.0    40.0
  1      2    20.0    50.0
  2      3    30.0    60.0
  Sum    NaN  60.0   150.0
  </code></pre>
  <p>I try to do this in two ways: the first one works out incorrectly - it gives all threes instead of <code>1,2,3</code>, the second option does not work at all.</p>
  <p>In addition, the first option counts the amount in this column, and I don't need it there. What should I do?</p>
  <p>Code:</p>
  <pre><code>import numpy as np
  import pandas as pd
  
  m=4
  df1 = pd.DataFrame(data = {'j': [np.nan, np.nan, np.nan], 'П, k=1': [10, 20, 30], 'П, k=2': [40, 50, 60]})
  df1.loc['Sum'] = df1.sum()
  
  # THE FIRST OPTION:
  # for j in range(1, m):
  #    df1['j'] = j
  
  # THE SECOND OPTION:
  bc = [x for x in range(1, m)]
  print(bc)
  df1['j'] = bc
  
  print(df1)
  </code></pre>