[英]How to filter columns in pandas?
i have a big dataset with more than 80 columns. 我有超过80列的大型数据集。
I wish to get a subset from dataset including the second column and columns from 10 to 40. 我希望从数据集中获得一个子集,包括第二列和10到40的列。
I know dt.iloc[:,10:40]
gives me the column from 10 to 40 . 我知道
dt.iloc[:,10:40]
给我的列从10到40 。
The question is, what is the easiest way to also include the second column to this subset as well? 问题是, 将第二列也包括到该子集中的最简单方法是什么?
使用np.r_
dt.iloc[:,np.r_[1,10:40]]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.