parameters: (join_units)
docstring: Return dtype and N/A values to use when concatenating specified units.
  
      Returned N/A value may be None which means there was no casting involved.
  
      Returns
      -------
      dtype
      na
docstring_summary: Return dtype and N/A values to use when concatenating specified units.
docstring_tokens: Return dtype and N / A values to use when concatenating specified units .
function: def get_empty_dtype_and_na(join_units):
      """
      Return dtype and N/A values to use when concatenating specified units.
  
      Returned N/A value may be None which means there was no casting involved.
  
      Returns
      -------
      dtype
      na
      """
      if len(join_units) == 1:
          blk = join_units[0].block
          if blk is None:
              return np.float64, np.nan
  
      if is_uniform_reindex(join_units):
          # XXX: integrate property
          empty_dtype = join_units[0].block.dtype
          upcasted_na = join_units[0].block.fill_value
          return empty_dtype, upcasted_na
  
      has_none_blocks = False
      dtypes = [None] * len(join_units)
      for i, unit in enumerate(join_units):
          if unit.block is None:
              has_none_blocks = True
          else:
              dtypes[i] = unit.dtype
  
      upcast_classes = defaultdict(list)
      null_upcast_classes = defaultdict(list)
      for dtype, unit in zip(dtypes, join_units):
          if dtype is None:
              continue
  
          if is_categorical_dtype(dtype):
              upcast_cls = 'category'
          elif is_datetime64tz_dtype(dtype):
              upcast_cls = 'datetimetz'
          elif issubclass(dtype.type, np.bool_):
              upcast_cls = 'bool'
          elif issubclass(dtype.type, np.object_):
              upcast_cls = 'object'
          elif is_datetime64_dtype(dtype):
              upcast_cls = 'datetime'
          elif is_timedelta64_dtype(dtype):
              upcast_cls = 'timedelta'
          elif is_sparse(dtype):
              upcast_cls = dtype.subtype.name
          elif is_extension_array_dtype(dtype):
              upcast_cls = 'object'
          elif is_float_dtype(dtype) or is_numeric_dtype(dtype):
              upcast_cls = dtype.name
          else:
              upcast_cls = 'float'
  
          # Null blocks should not influence upcast class selection, unless there
          # are only null blocks, when same upcasting rules must be applied to
          # null upcast classes.
          if unit.is_na:
              null_upcast_classes[upcast_cls].append(dtype)
          else:
              upcast_classes[upcast_cls].append(dtype)
  
      if not upcast_classes:
          upcast_classes = null_upcast_classes
  
      # create the result
      if 'object' in upcast_classes:
          return np.dtype(np.object_), np.nan
      elif 'bool' in upcast_classes:
          if has_none_blocks:
              return np.dtype(np.object_), np.nan
          else:
              return np.dtype(np.bool_), None
      elif 'category' in upcast_classes:
          return np.dtype(np.object_), np.nan
      elif 'datetimetz' in upcast_classes:
          # GH-25014. We use NaT instead of iNaT, since this eventually
          # ends up in DatetimeArray.take, which does not allow iNaT.
          dtype = upcast_classes['datetimetz']
          return dtype[0], tslibs.NaT
      elif 'datetime' in upcast_classes:
          return np.dtype('M8[ns]'), tslibs.iNaT
      elif 'timedelta' in upcast_classes:
          return np.dtype('m8[ns]'), tslibs.iNaT
      else:  # pragma
          try:
              g = np.find_common_type(upcast_classes, [])
          except TypeError:
              # At least one is an ExtensionArray
              return np.dtype(np.object_), np.nan
          else:
              if is_float_dtype(g):
                  return g, g.type(np.nan)
              elif is_numeric_dtype(g):
                  if has_none_blocks:
                      return np.float64, np.nan
                  else:
                      return g, None
  
      msg = "invalid dtype determination in get_concat_dtype"
      raise AssertionError(msg)
function_tokens: def get_empty_dtype_and_na ( join_units ) : if len ( join_units ) == 1 : blk = join_units [ 0 ] . block if blk is None : return np . float64 , np . nan if is_uniform_reindex ( join_units ) : # XXX: integrate property empty_dtype = join_units [ 0 ] . block . dtype upcasted_na = join_units [ 0 ] . block . fill_value return empty_dtype , upcasted_na has_none_blocks = False dtypes = [ None ] * len ( join_units ) for i , unit in enumerate ( join_units ) : if unit . block is None : has_none_blocks = True else : dtypes [ i ] = unit . dtype upcast_classes = defaultdict ( list ) null_upcast_classes = defaultdict ( list ) for dtype , unit in zip ( dtypes , join_units ) : if dtype is None : continue if is_categorical_dtype ( dtype ) : upcast_cls = 'category' elif is_datetime64tz_dtype ( dtype ) : upcast_cls = 'datetimetz' elif issubclass ( dtype . type , np . bool_ ) : upcast_cls = 'bool' elif issubclass ( dtype . type , np . object_ ) : upcast_cls = 'object' elif is_datetime64_dtype ( dtype ) : upcast_cls = 'datetime' elif is_timedelta64_dtype ( dtype ) : upcast_cls = 'timedelta' elif is_sparse ( dtype ) : upcast_cls = dtype . subtype . name elif is_extension_array_dtype ( dtype ) : upcast_cls = 'object' elif is_float_dtype ( dtype ) or is_numeric_dtype ( dtype ) : upcast_cls = dtype . name else : upcast_cls = 'float' # Null blocks should not influence upcast class selection, unless there # are only null blocks, when same upcasting rules must be applied to # null upcast classes. if unit . is_na : null_upcast_classes [ upcast_cls ] . append ( dtype ) else : upcast_classes [ upcast_cls ] . append ( dtype ) if not upcast_classes : upcast_classes = null_upcast_classes # create the result if 'object' in upcast_classes : return np . dtype ( np . object_ ) , np . nan elif 'bool' in upcast_classes : if has_none_blocks : return np . dtype ( np . object_ ) , np . nan else : return np . dtype ( np . bool_ ) , None elif 'category' in upcast_classes : return np . dtype ( np . object_ ) , np . nan elif 'datetimetz' in upcast_classes : # GH-25014. We use NaT instead of iNaT, since this eventually # ends up in DatetimeArray.take, which does not allow iNaT. dtype = upcast_classes [ 'datetimetz' ] return dtype [ 0 ] , tslibs . NaT elif 'datetime' in upcast_classes : return np . dtype ( 'M8[ns]' ) , tslibs . iNaT elif 'timedelta' in upcast_classes : return np . dtype ( 'm8[ns]' ) , tslibs . iNaT else : # pragma try : g = np . find_common_type ( upcast_classes , [ ] ) except TypeError : # At least one is an ExtensionArray return np . dtype ( np . object_ ) , np . nan else : if is_float_dtype ( g ) : return g , g . type ( np . nan ) elif is_numeric_dtype ( g ) : if has_none_blocks : return np . float64 , np . nan else : return g , None msg = "invalid dtype determination in get_concat_dtype" raise AssertionError ( msg )