Rows

  • Rows consists of Indexes
  •  

  • Index numbers starts from zero excluding Headers of dataframe
  •  

  • By default Pandas assings index numbers to the DataFrame
  •  

  • We can assign list of headers\labels against the "Index" to replace the index numbers
  •  

    indexdata = ['a','b','c','d','e']

  • df = pd.DataFrame(rowsdata, columns = headerdata, index = indexdata)
  •  

    Print first two rows

  • print(df[0:2]) # print first two rows
  •  

    {% for c in range(colscount) %}
    {{headerdata[c]}}
    {% endfor %}
    {% for i in range(rowscount) %}
    {% for c in range(colscount) %}
    {{FirstTwo[i][c]}}
    {% endfor %}
    {% endfor %}

     

     

  • print(df[::3]) # print every third row
  •  

    {% for c in range(colscount) %}
    {{headerdata[c]}}
    {% endfor %}
    {% for i in range(r) %}
    {% for c in range(colscount) %}
    {{Everythird[i][c]}}
    {% endfor %}
    {% endfor %}