[Python] How to ignore the first line of data when processing CSV data?

Discussão em 'Python' iniciado por Stack, Setembro 11, 2024.

  1. Stack

    Stack Membro Participativo

    I am asking Python to print the minimum number from a column of CSV data, but the top row is the column number, and I don't want Python to take the top row into account. How can I make sure Python ignores the first line?

    This is the code so far:

    import csv

    with open('all16.csv', 'rb') as inf:
    incsv = csv.reader(inf)
    column = 1
    datatype = float
    data = (datatype(column) for row in incsv)
    least_value = min(data)

    print least_value


    Could you also explain what you are doing, not just give the code? I am very very new to Python and would like to make sure I understand everything.

    Continue reading...

Compartilhe esta Página