code: def infer(data, row_limit, confidence, encoding, to_file):
      
      descriptor = tableschema.infer(data,
                                     encoding=encoding,
                                     limit=row_limit,
                                     confidence=confidence)
      if to_file:
          with io.open(to_file, mode='w+t', encoding='utf-8') as dest:
              dest.write(json.dumps(descriptor, ensure_ascii=False, indent=4))
      click.echo(descriptor)
docs: Infer a schema from data.
  
      * data must be a local filepath
      * data must be CSV
      * the file encoding is assumed to be UTF-8 unless an encoding is passed
        with --encoding
      * the first line of data must be headers
      * these constraints are just for the CLI