【发布时间】:2020-12-29 13:51:27
【问题描述】:
我正在尝试在 python 中选择 pandas 数据框中的所有列,但使用 iloc 的第一列除外。
我可以使用代码选择除最后一列之外的所有列
Pre_Processed.iloc[:,0:-1]
有人可以帮我解决这个问题吗?
【问题讨论】:
-
Pre_Processed.iloc[:, 1:] ... google indexing in python .... 你的索引就像-iterable[start:end:step]
-
也叫“切片”。试试this answer
标签: python dataframe indexing multiple-columns