在大熊猫中选择多个通过ILOC单独列
我的文件包含 15 列和 10 行。 我想像这样在它们之间选择一些列(1:5 和 7:11 和 13:15)。 我写的类似于:
'df.iloc[: ,[1:6,7:12,13:]]'
或者
'df.iloc[: ,[[1:6],[7:12],[13:]]]'
但它们都不起作用。我有挑战。
有人可以帮忙吗?
my file contains 15 columns and 10 rows.
I want to select some columns between them like this (1:5 and 7:11 and 13:15).
I wrote it similer to:
'df.iloc[: ,[1:6,7:12,13:]]'
or
'df.iloc[: ,[[1:6],[7:12],[13:]]]'
but none of them worked. I have challenge.
may someone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您可以使用
np.r_
来进行切片表示法:You can use
np.r_
to have slice notation: