code: def run_analysis(args):
    
    import google.datalab.bigquery as bq
    if args.bigquery_table:
      table = bq.Table(args.bigquery_table)
      schema_list = table.schema._bq_schema
    else:
      schema_list = json.loads(
          file_io.read_file_to_string(args.schema_file).decode())
      table = bq.ExternalDataSource(
          source=args.input_file_pattern,
          schema=bq.Schema(schema_list))
  
    # Check the schema is supported.
    for col_schema in schema_list:
      col_type = col_schema['type'].lower()
      if col_type != 'string' and col_type != 'integer' and col_type != 'float':
        raise ValueError('Schema contains an unsupported type %s.' % col_type)
  
    run_numerical_analysis(table, schema_list, args)
    run_categorical_analysis(table, schema_list, args)
  
    # Save a copy of the schema to the output location.
    file_io.write_string_to_file(
        os.path.join(args.output_dir, SCHEMA_FILE),
        json.dumps(schema_list, indent=2, separators=(',', ': ')))
docs: Builds an analysis file for training.
  
    Uses BiqQuery tables to do the analysis.
  
    Args:
      args: command line args
  
    Raises:
      ValueError if schema contains unknown types.