【发布时间】:2023-01-19 22:01:05
【问题描述】:
我有一个包含 3500 多行的基因组数据集。我需要从中删除两列(“长度”和“蛋白质名称”)中的行。我如何为此目的指定条件。
import csv #importing the csv module or method
#opening a new csv file
file = open('C:\\Users\\Admin\\Downloads\\csv.csv', 'r')
type(file)
#reading the csv file
csvreader = csv.reader(file)
header = []
header = next(csvreader)
print(header)
#extracting rows from the csv file
rows = []
for row in csvreader:
rows.append(row)
print(rows)
我是python生物信息学数据分析的初学者,没有尝试过任何广泛的方法。我不知道如何从这里开始。我已经完成了打开和读取 csv 文件的工作。我还提取了列标题。但我不知道如何从这里开始。请帮忙。
【问题讨论】:
-
您需要从“长度”和“蛋白质名称”列中删除所有行吗?
-
或者您是否需要从每一行中删除“长度”和“蛋白质名称”列?
标签: python dataframe csv row readfile