在excel中,我有=if((COUNTIFS(B:B,B2,A:A,"=A"))=0,"No","Yes")
基本上,我如何遍历所有行,在MatchID中识别Cell对Range(MatchID)和如果Range(provider)=“A”。
在新列中记录条目。
在VBA和excel中做的很简单但是python / Pandas对我来说是新的,但仍然略微超出了我的脑力。
这可能吗?
感谢您的帮助。
答案 0 :(得分:0)
这是一个矢量化解决方案。通常,请尝试使用集合进行比较和内置pandas
功能,例如map
/ isin
。这不仅更有效,而且更具可读性。
filter_set = set(df.loc[df['Provider']=='A', 'MatchID']) # set of MatchIDs with Provider 'A'
df['Solution'] = df['MatchID'].isin(filter_set).map({True: 'Yes', False: 'No'})
答案 1 :(得分:0)
此代码将有所帮助。
#Pipeline file for project
pipeline:
load-test:
commands:
- "./gradlew testLoad"
image: "java:8"
zipping:
image: ubuntu
when:
status: [ failure,success ]
commands:
- "cp -r path/to/workspace/build/gatling-results/* /test-results"
- "tar -czf gatling-result.tar.gz /test-results/*"
email:
when:
status: [ failure,success ] #replace with [failure,changed] as we dont want to fill inbox with attachments
image: drillster/drone-email
from: drone-noreply@XXXXX.com
host: smtp.XXXX.com
port: 25
skip_verify: true
subject: >
{{ repo.owner }}/{{ repo.name }}: {{ build.status }}
recipients: [ user@email.com ]
attachment: path/to/workspace/gatling-result.tar.gz
答案 2 :(得分:-1)
你可以这样做:
cond_list = df.loc[df['Provider']=='A', 'MatchID'].tolist() #list of MatchIDs that have Provider with value 'A'
df['Solution'] = df['MatchID'].apply(lambda x: 'Yes' if x in cond_list else 'No')