lundi 23 novembre 2020

How to return a column by checking multiple column with True and False without if statements

How to get this desired output without using if statements ? and checking row by row

import pandas as pd 

test = pd.DataFrame()
test['column1'] = [True, True, False]
test['column2']= [False,True,False]

index   column1     column2

0         True      False
1         True      True
2         False     False

desired output:

index   column1     column2   column3

0         True      False     False
1         True      True      True
2         False     False     False


Your help is much appriciated.

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire