python读取csv文件的某一列或某几列
import csv
import pandas as pd
with open('D:Data新建文件夹list3.2.csv','r') as csvfile:
reader = csv.reader(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.','slice no.'])
print(d)
d = pd.read_csv('D:Data新建文件夹list3.2.csv', usecols=['case', 'roi', 'eq. diam.','x loc.','y loc.','slice no.'],
nrows=10)
# 这是表示读取前10行