MCPcopy
hub / github.com/tensorflow/tfjs-examples / getColumnData

Method getColumnData

jena-weather/data.js:208–233  ·  view source on GitHub ↗
(
      columnName, includeTime, normalize, beginIndex, length, stride)

Source from the content-addressed store, hash-verified

206 }
207
208 getColumnData(
209 columnName, includeTime, normalize, beginIndex, length, stride) {
210 const columnIndex = this.dataColumnNames.indexOf(columnName);
211 tf.util.assert(columnIndex >= 0, `Invalid column name: ${columnName}`);
212
213 if (beginIndex == null) {
214 beginIndex = 0;
215 }
216 if (length == null) {
217 length = this.numRows - beginIndex;
218 }
219 if (stride == null) {
220 stride = 1;
221 }
222 const out = [];
223 for (let i = beginIndex; i < beginIndex + length && i < this.numRows;
224 i += stride) {
225 let value = normalize ? this.normalizedData[i][columnIndex] :
226 this.data[i][columnIndex];
227 if (includeTime) {
228 value = {x: this.dateTime[i].getTime(), y: value};
229 }
230 out.push(value);
231 }
232 return out;
233 }
234
235 /**
236 * Get a data iterator function.

Callers 4

data_test.jsFile · 0.80
makeTimeSeriesChartFunction · 0.80

Calls 1

getTimeMethod · 0.80

Tested by

no test coverage detected