我有一个Pandas DataFrame,其中包含一个列表列,如下所示。
selection weeks
0 2 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
1 3 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
2 1 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
我该如何根据选择值获取前N个元素以获得以下结果?
selection weeks select_week
0 2 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52] [43, 44]
1 3 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52] [43, 44, 45]
2 1 [43, 44, 45, 46, 47, 48, 49, 50, 51, 52] [43]