def concat(dfs, axis=0, join='outer', interleave_partitions=False):
 if (not isinstance(dfs, list)):
  raise TypeError('dfs must be a list of DataFrames/Series objects')
 if (len(dfs) == 0):
  raise ValueError('No objects to concatenate')
 if (len(dfs) == 1):
  return dfs[0]
 if (join not in ('inner', 'outer')):
  raise ValueError("'join' must be 'inner' or 'outer'")
 axis = DataFrame._validate_axis(axis)
 dasks = [df for df in dfs if isinstance(df, _Frame)]
 dfs = _maybe_from_pandas(dfs)
 if (axis == 1):
  if all((df.known_divisions for df in dasks)):
   return concat_indexed_dataframes(dfs, axis=axis, join=join)
  elif ((len(dasks) == len(dfs)) and all(((not df.known_divisions) for df in dfs)) and (len({df.npartitions for df in dasks}) == 1)):
   warn("Concatenating dataframes with unknown divisions.\nWe're assuming that the indexes of each dataframes are \naligned. This assumption is not generally safe.")
   return concat_unindexed_dataframes(dfs)
  else:
   raise ValueError('Unable to concatenate DataFrame with unknown division specifying axis=1')
 elif all((df.known_divisions for df in dasks)):
  if all(((dfs[i].divisions[(-1)] < dfs[(i + 1)].divisions[0]) for i in range((len(dfs) - 1)))):
   divisions = []
   for df in dfs[:(-1)]:
    divisions += df.divisions[:(-1)]
   divisions += dfs[(-1)].divisions
   return stack_partitions(dfs, divisions, join=join)
  elif interleave_partitions:
   return concat_indexed_dataframes(dfs, join=join)
  else:
   raise ValueError('All inputs have known divisions which cannot be concatenated in order. Specify interleave_partitions=True to ignore order')
 else:
  divisions = ([None] * (sum([df.npartitions for df in dfs]) + 1))
  return stack_partitions(dfs, divisions, join=join)

def concat ( dfs , axis = 0 , join = 'outer' , interleave_partitions = False ) : if ( not isinstance ( dfs , list ) ) : raise TypeError ( 'dfs must be a list of DataFrames/Series objects' ) if ( len ( dfs ) == 0 ) : raise ValueError ( 'No objects to concatenate' ) if ( len ( dfs ) == 1 ) : return dfs [ 0 ] if ( join not in ( 'inner' , 'outer' ) ) : raise ValueError ( "'join' must be 'inner' or 'outer'" ) axis = DataFrame . _validate_axis ( axis ) dasks = [ df for df in dfs if isinstance ( df , _Frame ) ] dfs = _maybe_from_pandas ( dfs ) if ( axis == 1 ) : if all ( ( df . known_divisions for df in dasks ) ) : return concat_indexed_dataframes ( dfs , axis = axis , join = join ) elif ( ( len ( dasks ) == len ( dfs ) ) and all ( ( ( not df . known_divisions ) for df in dfs ) ) and ( len ( { df . npartitions for df in dasks } ) == 1 ) ) : warn ( "Concatenating dataframes with unknown divisions.\nWe're assuming that the indexes of each dataframes are \naligned. This assumption is not generally safe." ) return concat_unindexed_dataframes ( dfs ) else : raise ValueError ( 'Unable to concatenate DataFrame with unknown division specifying axis=1' ) elif all ( ( df . known_divisions for df in dasks ) ) : if all ( ( ( dfs [ i ] . divisions [ ( - 1 ) ] < dfs [ ( i + 1 ) ] . divisions [ 0 ] ) for i in range ( ( len ( dfs ) - 1 ) ) ) ) : divisions = [ ] for df in dfs [ : ( - 1 ) ] : divisions += df . divisions [ : ( - 1 ) ] divisions += dfs [ ( - 1 ) ] . divisions return stack_partitions ( dfs , divisions , join = join ) elif interleave_partitions : return concat_indexed_dataframes ( dfs , join = join ) else : raise ValueError ( 'All inputs have known divisions which cannot be concatenated in order. Specify interleave_partitions=True to ignore order' ) else : divisions = ( [ None ] * ( sum ( [ df . npartitions for df in dfs ] ) + 1 ) ) return stack_partitions ( dfs , divisions , join = join )
concatenate many bags together .