使用 iloc 在 python 数据帧中索引 select 除了第一列之外的所有列
Indexing in python dataframe using iloc to select all columns except the first column
我正在尝试 select python 中 pandas 数据帧中的所有列,除了使用 iloc 的第一列。
我可以 select 使用代码
除了最后一列之外的所有列
Pre_Processed.iloc[:,0:-1]
谁能帮我解决这个问题?
试试这个
Pre_Processed.iloc[:,1:]
可迭代的索引像--iterable[start:end:stride]
了解更多 stride-https://www.digitalocean.com/community/tutorials/how-to-index-and-slice-strings-in-python-3#:~:text=The%20third%20parameter%20specifies%20the,two%20index%20numbers%20is %20 检索到。
我正在尝试 select python 中 pandas 数据帧中的所有列,除了使用 iloc 的第一列。
我可以 select 使用代码
除了最后一列之外的所有列Pre_Processed.iloc[:,0:-1]
谁能帮我解决这个问题?
试试这个
Pre_Processed.iloc[:,1:]
可迭代的索引像--iterable[start:end:stride]
了解更多 stride-https://www.digitalocean.com/community/tutorials/how-to-index-and-slice-strings-in-python-3#:~:text=The%20third%20parameter%20specifies%20the,two%20index%20numbers%20is %20 检索到。