title: merged dataframe failing to join by id after return from function
body: <p>I have the following dataframe called order_df:</p>
  <pre><code>id      count   created_at  group_field type
  5753    -1300   2020-11-24  3d74a       new
  f12a    -1      2020-11-26  4fa87       new
  cf01    -1      2020-11-27  ce13d       new
  0b19    -1      2020-11-30  551de       new
  1512    -1      2020-11-30  476ea       new
  7d07    -1      2020-11-30  79a27       new
  3b5e    -195    2020-12-03  f3dba       new
  </code></pre>
  <p>which I am trying to merge with cids_df:</p>
  <pre><code>group_field identifer
  3d74a       adc
  4fa87       vbr
  ce13d       add
  551de       bg2
  476ea       ggb3
  79a27       dd2d
  f3dba       f4ef
  </code></pre>
  <p>This is my code:</p>
  <pre><code>def get_ids(request_type, unique_id):
      if request_type == 'order':
          list_to_string_id = str(unique_id)[1:-1]
          query = 'select ocr.id as '&quot;group_field&quot;', o.identifier from outlet o inner join ' + request_type + ' ocr on ocr.unique_id=o.unique_id where ocr.id in('+list_to_string_id+');'
          outlet_df = pd.read_sql(query, engine)
          return outlet_df
  
  df['group_field'] = df['r_id'].str.extract('(?P&lt;outlet_id&gt;/outlet_id/.+)')
  if df['group_field'].any():
      request_type = 'order'
      order_df = main.copy()
      order_df = order_df[order_cancel_df['group_field'].notna()]
      order_df['group_field'] = order_df['id'].str.extract('oulet_id/(.+?)$')
      unique_id = order_df['group_field'].dropna().tolist()
      cids_df = get_ids(request_type, unique_id)
      order_df = pd.merge(order_df, cids_df, on='group_field', how='outer')
  </code></pre>
  <p>I'm looking to do an outer join just in case <code>cids</code> comes up with more values than <code>order_df</code>. When I merge the two dataframes I am getting this output:</p>
  <pre><code>id      count   created_at  group_field type    identifier
  5753    -1300   11/24/20    3d74a       new 
  f12a    -1      2020-11-26  4fa87       new 
  cf01    -1      2020-11-27  ce13d       new 
  0b19    -1      2020-11-30  551de       new 
  1512    -1      2020-11-30  476ea       new 
  7d07    -1      2020-11-30  79a27       new 
  3b5e    -195    2020-11-22  f3dba       new 
                              3d74a               adc
                              4fa87               vbr
                              ce13d               add
                              551de               bg2
                              476ea               ggb3
                              79a27               dd2d
                              f3dba               f4ef
  </code></pre>
  <p>I would expect the join to merge on group_field but instead it's just stacking the two dataframes together.</p>
  <p>Is there a better method to joining the two dataframes together beside using merge?</p>