Reading rows from a CSV file in Python

前端 未结 10 2407
慢半拍i
慢半拍i 2020-11-30 23:58

I have a CSV file, here is a sample of what it looks like:

Year:  Dec: Jan:
1      50   60
2      25   50
3      30   30
4      40   20
5      10   10
         


        
10条回答
  •  庸人自扰
    2020-12-01 00:40

    Example:

    import pandas as pd
    
    data = pd.read_csv('data.csv')
    
    # read row line by line
    for d in data.values:
      # read column by index
      print(d[2])
    

提交回复
热议问题