def format_nmds_coords(samples, points, stress):
 result = []
 col_headers = [('NMDS' + str(aa)) for aa in range(1, (points.shape[1] + 1))]
 result.append(('samples DCTB ' + ' DCTB '.join(col_headers)))
 for (name, row) in zip(samples, points):
  result.append(' DCTB '.join(([name] + map(str, row))))
 result.append('')
 result.append((((('stress DCTB ' + str(stress)) + ' DCTB ') + ('0 DCTB ' * (len(col_headers) - 2))) + '0'))
 result.append(('% variation explained DCTB ' + ('0 DCTB ' * len(col_headers))))
 return '\n'.join(result)

def format_nmds_coords ( samples , points , stress ) : result = [ ] col_headers = [ ( 'NMDS' + str ( aa ) ) for aa in range ( 1 , ( points . shape [ 1 ] + 1 ) ) ] result . append ( ( 'samples DCTB ' + ' DCTB ' . join ( col_headers ) ) ) for ( name , row ) in zip ( samples , points ) : result . append ( ' DCTB ' . join ( ( [ name ] + map ( str , row ) ) ) ) result . append ( '' ) result . append ( ( ( ( ( 'stress DCTB ' + str ( stress ) ) + ' DCTB ' ) + ( '0 DCTB ' * ( len ( col_headers ) - 2 ) ) ) + '0' ) ) result . append ( ( '% variation explained DCTB ' + ( '0 DCTB ' * len ( col_headers ) ) ) ) return '\n' . join ( result )
samples is list .