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()
Adding a new column in pandas dataframe from another dataframe with different index
merge(left, right, how='left', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True)
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