MCPcopy Create free account
hub / github.com/javascriptdata/danfojs / shape

Method shape

src/danfojs-base/core/generic.ts:344–357  ·  view source on GitHub ↗

* Returns the shape of the NDFrame. Shape is determined by [row length, column length]

()

Source from the content-addressed store, hash-verified

342 * Returns the shape of the NDFrame. Shape is determined by [row length, column length]
343 */
344 get shape(): Array<number> {
345 if (this.$data.length === 0) {
346 if (this.$columns.length === 0) return [0, 0];
347 else return [0, this.$columns.length];
348 }
349 if (this.$isSeries) {
350 return [this.$data.length, 1];
351 } else {
352 const rowLen = (this.$data).length
353 const colLen = (this.$data[0] as []).length
354 return [rowLen, colLen]
355 }
356
357 }
358
359 /**
360 * Returns the underlying data in Array format.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected