* Internal function to set the index of the NDFrame with the specified * array of indices. Performs all necessary checks to ensure that the * index is valid.
(index: Array<string | number> | undefined)
| 274 | * index is valid. |
| 275 | */ |
| 276 | $setIndex(index: Array<string | number> | undefined): void { |
| 277 | if (index) { |
| 278 | |
| 279 | if (this.$data.length != 0 && index.length != this.shape[0]) { |
| 280 | ErrorThrower.throwIndexLengthError(this, index) |
| 281 | } |
| 282 | if (Array.from(new Set(index)).length !== this.shape[0]) { |
| 283 | ErrorThrower.throwIndexDuplicateError() |
| 284 | } |
| 285 | |
| 286 | this.$index = index |
| 287 | } else { |
| 288 | this.$index = utils.range(0, this.shape[0] - 1) //generate index |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Internal function to reset the index of the NDFrame using a range of indices. |
no test coverage detected