Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
DataFrame df が与えられた場合、次のようなことをしたいと思います。
if df['one'] >= df['two']: df['three'] = df['four'] df['five'] = df['two'] / df['four']
.locブール索引付けで属性を使用してください。
.loc
condition = df.one >= df.two df.loc[condition, 'three'] = df['four'] df.loc[condition, 'five'] = df['two'] / df['four']