Add new column based on condition on some other column in pandas.
# np.where(condition, value if condition is true, value if condition is false)
df['hasimage'] = np.where(df['photos']!= '[]', True, False)
df.head()
Add new column based on condition on some other column in pandas.
# np.where(condition, value if condition is true, value if condition is false)
df['hasimage'] = np.where(df['photos']!= '[]', True, False)
df.head()
how to add coloumn based on other column
metadata['class_pnemonia'] = metadata['class'].astype('category').map({0: 'HEALTHY ', 1: 'PNEUMONIA'})
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