make a condition statement on column pandas
df['color'] = ['red' if x == 'Z' else 'green' for x in df['Set']]
make a condition statement on column pandas
df['color'] = ['red' if x == 'Z' else 'green' for x in df['Set']]
make a condition statement on column pandas
df.loc[df['column name'] condition, 'new column name'] = 'value if condition is met'
pandas look for values in column with condition
# The common syntax is df.loc[], the condition is put in the bracket
#Eg, look for rows with column1 > 5 and column2 = 3
df.loc[(df['column_1'] > 5) & (df['column_2'] = 3)]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us