MCPcopy
hub / github.com/tensorflow/tfjs / maybeReadHeaderLine

Method maybeReadHeaderLine

tfjs-data/src/datasets/csv_dataset.ts:127–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125 }
126
127 private async maybeReadHeaderLine() {
128 if (this.hasHeader) {
129 const iter = await this.base.iterator();
130 const firstElement = await iter.next();
131 if (firstElement.done) {
132 throw new Error('No data was found for CSV parsing.');
133 }
134 const firstLine: string = firstElement.value;
135 const headers = this.parseRow(firstLine, false);
136 return headers;
137 } else {
138 return null;
139 }
140 }
141
142 /**
143 * Create a `CSVDataset`.

Callers 1

setColumnNamesMethod · 0.95

Calls 3

parseRowMethod · 0.95
iteratorMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected