38 PKG =
'diagnostic_analysis' 40 roslib.load_manifest(PKG)
49 output_file = csv_file[:-4] +
'_sparse.csv' 51 input_reader = csv.reader(open(csv_file,
'rb'))
53 f = open(output_file,
'wb')
54 output_writer = csv.writer(f)
57 for row
in input_reader:
58 if skip_count == skip:
59 output_writer.writerow(row)
62 skip_count = skip_count + 1
71 output_file = csv_file[:-4] +
'_sprs_len.csv' 73 input_reader = csv.reader(open(csv_file,
'rb'))
75 f = open(output_file,
'wb')
76 output_writer = csv.writer(f)
79 orig_len = len(open(csv_file,
'r').read().split('\n'))
80 skip = max(int(orig_len / length), 1)
83 for row
in input_reader:
84 if skip_count >= skip:
85 output_writer.writerow(row)
88 skip_count = skip_count + 1
def make_sparse_length(csv_file, length)
Makes sparse CSV with the given number of rows.
def make_sparse_skip(csv_file, skip)
Makes sparse CSV by skipping every nth value.