How does the header parameter work in the function read_csv()?



  • I can't understand the parameter. header function read_csv()

    Please provide an explanation of his work on the Screenchots.

    введите сюда описание изображения

    введите сюда описание изображения

    введите сюда описание изображения введите сюда описание изображения



  • Function pd.read_csv It doesn't have anything to do with it. You just passed the parameter. header Synthetic error design:

    print([0:2])

    File "<ipython-input-63-1c502b3dc513>", line 1
    [0:2]
    ^
    SyntaxError: invalid syntax

    Cuts can be applied to relevant sites, such as lists or crusts. You have him on your own and Python doesn't understand that syntax design.


    I still want to know what a header parameter is for.

    Parameter header is used to indicate clearly which lines are considered to be headlines (posts). For example, if there are no column names in the file, it is necessary to use header=None - in this case the columns will be numbered: 0, 1, 2, ...

    Default pd.read_csv(...) Considers that the first line of the CSV file contains the names of the columns. In other words, the parameter values header default - 1

    Also Pandas supports https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html - in this case the parameter header The list should be transmitted with the string indexes of the file containing the names of the columns (indication begins with zero).



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2