s = pd.Series({0: 'registration address-complement-insert-confirmation input',
1: 'decision-tree first-interaction-validation options',
2: 'decision-tree invalid-format-validation options',
3: 'decision-tree first-interaction-validation options',
4: 'registration address-complement-request view',
5: 'onboarding return-start origin',
6: 'registration address-complement-request origin',
7: 'decision-tree identified-regex options',
8: 'decision-tree first-interaction-validation options',
9: 'decision-tree first-interaction-validation options'})
我有下面的序列对象。我想做的是Map它,并将“onboarding return-start origin”之后的每一个字符串都标记为true。有什么想法可以让我建立这个条件吗?
预期结果
s = pd.Series({0: False,
1: False,
2: False,
3: False,
4: False,
5: True,
6: True,
7: True,
8: True,
9: True})
1条答案
按热度按时间hmae6n7t1#
使用
Series.cummax
,通过Series.eq
测试第一个匹配值: