MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / transpose

Method transpose

src/danfojs-base/core/frame.ts:2687–2703  ·  view source on GitHub ↗
(options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

2685 **/
2686 transpose(options?: { inplace?: boolean }): DataFrame
2687 transpose(options?: { inplace?: boolean }): DataFrame | void {
2688 const { inplace } = { inplace: false, ...options }
2689 const newData = utils.transposeArray(this.values)
2690 const newColNames = [...this.index.map(i => i.toString())]
2691
2692 if (inplace) {
2693 this.$setValues(newData, false, false)
2694 this.$setIndex([...this.columns])
2695 this.$setColumnNames(newColNames)
2696 } else {
2697 return new DataFrame(newData, {
2698 index: [...this.columns],
2699 columns: newColNames,
2700 config: { ...this.config }
2701 })
2702 }
2703 }
2704
2705 /**
2706 * Returns the Transpose of the DataFrame. Similar to `transpose`.

Callers

nothing calls this directly

Calls 6

transposeArrayMethod · 0.80
$setValuesMethod · 0.80
mapMethod · 0.65
toStringMethod · 0.65
$setIndexMethod · 0.65
$setColumnNamesMethod · 0.65

Tested by

no test coverage detected