【发布时间】:2019-09-18 17:29:16
【问题描述】:
我有以下列表:
indices_to_remove: [0,1,2,3,..,600,800,801,802,....,1200,1600,1601,1602,...,1800]
我基本上有 3 个连续索引的子集:
- 0-600
- 800-1200
- 1600-1800
我想创建 3 个仅包含连续数字的不同小列表。
预期结果:
indices_to_remove_1 : [0,1,2,3,....,600]
indices_to_remove_2 : [800,801,802,....,1200]
indices_to_remove_3 : [1600,1601,1602,....., 1800]
P.S:数字是任意随机的;此外,我可能会遇到超过 3 个或更少的子集。
【问题讨论】:
-
您想在空白处拆分列表吗?
-
基本上是的。最重要的是将连续索引拆分为一个子列表@StephenRauch
标签: python arrays pandas list split