python读取csv⽂件的某⼀列或某⼏列import csv
import pandas as pd
with open('D:\Data\新建⽂件夹\list3.2.csv','r') as csvfile:
reader = ader(csvfile)
column1 = [row[1]for row in reader]
print(column1)
# 下⾯是按照列属性读取的
d = pd.read_csv('D:\Data\新建⽂件夹\list3.2.csv', usecols=['case', 'roi', 'eq. diam.','x loc.','y loc.','slic
e no.'])
print(d)
d = pd.read_csv('D:\Data\新建⽂件夹\list3.2.csv', usecols=['case', 'roi', 'eq. diam.','x loc.','y loc.','slic
e no.'],
nrows=10)
# 这是表⽰读取前10⾏
python怎么读csv数据

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。