title: Python ValueError from np.where create flag based on one condition
body: <p>If the city has been mentioned in <code>cities_specific</code> I would like to create a flag in the <code>cities_all</code> data. It's just a minimal example and in reality I would like to create multiple of these flags based on multiple data frames. That's why I tried to solve it with <code>isin</code> instead of a join.</p>
  <p>However, I am running into  <code>ValueError: Length of values (3) does not match length of index (7)</code>.</p>
  <pre><code># import packages
  import pandas as pd
  import numpy as np
  
  
  # create minimal data 
  cities_specific = pd.DataFrame({'city': ['Melbourne', 'Cairns', 'Sydney'],
                         'n': [10, 4, 8]})
  cities_all = pd.DataFrame({'city': ['Vancouver', 'Melbourne', 'Athen', 'Vienna', 'Cairns',
                                      'Berlin', 'Sydney'],
                            'inhabitants': [675218, 5000000, 664046, 1897000, 150041, 3769000, 5312000]})
  
  
  # get value error
  # how can this be solved differently?
  cities_all.assign(in_cities_specific=np.where(cities_specific.city.isin(cities_all.city), '1', '0'))
  
  
  # that's the solution I would like to get
  expected_solution = pd.DataFrame({'city': ['Vancouver', 'Melbourne', 'Athen', 'Vienna', 'Cairns',
                                      'Berlin', 'Sydney'],
                            'inhabitants': [675218, 5000000, 664046, 1897000, 150041, 3769000, 5312000],
                            'in_cities': [0, 1, 0, 0, 1, 0, 1]})
  </code></pre>