parameters: (filename, ratio)
docstring: Create a smaller dataset of only 1/ratio of original data.
docstring_summary: Create a smaller dataset of only 1/ratio of original data.
docstring_tokens: Create a smaller dataset of only 1 / ratio of original data .
function: def shrink_csv(filename, ratio):
    """Create a smaller dataset of only 1/ratio of original data."""
    filename_small = filename.replace('.', '_small.')
    with gfile.Open(filename_small, 'w') as csv_file_small:
      writer = csv.writer(csv_file_small)
      with gfile.Open(filename) as csv_file:
        reader = csv.reader(csv_file)
        i = 0
        for row in reader:
          if i % ratio == 0:
            writer.writerow(row)
          i += 1
function_tokens: def shrink_csv ( filename , ratio ) : filename_small = filename . replace ( '.' , '_small.' ) with gfile . Open ( filename_small , 'w' ) as csv_file_small : writer = csv . writer ( csv_file_small ) with gfile . Open ( filename ) as csv_file : reader = csv . reader ( csv_file ) i = 0 for row in reader : if i % ratio == 0 : writer . writerow ( row ) i += 1