当用pandas解析一些数据时,我只想选择2列。在
pd.read_table的帮助提到了一个usecols选项,它似乎正是我想要的:usecols : array-like, default None
Return a subset of the columns. All elements in this array must either
be positional (i.e. integer indices into the document columns) or strings
that correspond to column names provided either by the user in `names` or
inferred from the document header row(s). For example, a valid `usecols`
parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. Using this parameter
results in much faster parsing time and lower memory usage.
我的数据一旦被读取,似乎有从0到6的列编号:
^{pr2}$
但是,当我试图只保留索引(第3列)和最后一个索引(第6列)时,会出现以下错误:In [339]: pd.read_table("../RNA_Seq_analyses/mapping_worm_number_tests/hisat2/mapped_C_elegans/intersect_count/W100_1_on_C_elegans/protein_coding_fwd_counts.txt", index_</