* Updates the internal $data property to the specified value * @param values An array of values to set * @param checkLength Whether to check the length of the new values and the existing row length * @param checkColumnLength Whether to check the length of the new values and the existi
(values: ArrayType1D | ArrayType2D, checkLength: boolean = true, checkColumnLength: boolean = true)
| 370 | * @param checkColumnLength Whether to check the length of the new values and the existing column length |
| 371 | * */ |
| 372 | $setValues(values: ArrayType1D | ArrayType2D, checkLength: boolean = true, checkColumnLength: boolean = true): void { |
| 373 | if (this.$isSeries) { |
| 374 | if (checkLength && values.length != this.shape[0]) { |
| 375 | ErrorThrower.throwRowLengthError(this, values.length) |
| 376 | } |
| 377 | |
| 378 | this.$data = values |
| 379 | this.$dtypes = utils.inferDtype(values) //Dtype may change depeneding on the value set |
| 380 | |
| 381 | if (!this.$config.isLowMemoryMode) { |
| 382 | this.$dataIncolumnFormat = values |
| 383 | } |
| 384 | |
| 385 | } else { |
| 386 | if (checkLength && values.length != this.shape[0]) { |
| 387 | ErrorThrower.throwRowLengthError(this, values.length) |
| 388 | } |
| 389 | |
| 390 | if (checkColumnLength) { |
| 391 | values.forEach(value => { |
| 392 | if ((value as ArrayType1D).length != this.shape[1]) { |
| 393 | ErrorThrower.throwColumnLengthError(this, values.length) |
| 394 | } |
| 395 | }) |
| 396 | } |
| 397 | |
| 398 | this.$data = values |
| 399 | this.$dtypes = utils.inferDtype(values) |
| 400 | |
| 401 | if (!this.$config.isLowMemoryMode) { |
| 402 | this.$dataIncolumnFormat = utils.transposeArray(values) |
| 403 | } |
| 404 | |
| 405 | } |
| 406 | |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Returns the underlying data in Array column format. |