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

前端 未结 17 1965
庸人自扰
庸人自扰 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:35

    this might be a very old question but with pandas we have a very easy solution

    import pandas as pd
    
    data=pd.read_csv('all16.csv',skiprows=1)
    data['column'].min()
    

    with skiprows=1 we can skip the first row then we can find the least value using data['column'].min()

提交回复
热议问题