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

前端 未结 17 2143
庸人自扰
庸人自扰 2020-11-22 10:05

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. Ho

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 10:43

    Well, my mini wrapper library would do the job as well.

    >>> import pyexcel as pe
    >>> data = pe.load('all16.csv', name_columns_by_row=0)
    >>> min(data.column[1])
    

    Meanwhile, if you know what header column index one is, for example "Column 1", you can do this instead:

    >>> min(data.column["Column 1"])
    

提交回复
热议问题