public function columns() : array
    {
        if ($this->numRows() > 1) {
            return array_map(null, ...$this->samples);
        }

        $n = $this->numColumns();

        $columns = [];

        for ($i = 0; $i < $n; $i++) {
            $columns[] = array_column($this->samples, $i);
        }

        return $columns;
    }
public function columns() : array
    {
        if ($this->numRows() > 1) {
            return array_map(null, ...$this->samples);
        }

        $n = $this->numColumns();

        $columns = [];

        for ($i = 0; $i < $n; $i++) {
            $columns[] = array_column($this->samples, $i);
        }

        return $columns;
    }
public function columns ( ) : array { if ( $ this -> numRows ( ) > 1 ) { return array_map ( null , ... $ this -> samples ) ; } $ n = $ this -> numColumns ( ) ; $ columns = [ ] ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ columns [ ] = array_column ( $ this -> samples , $ i ) ; } return $ columns ; }
Rotate the dataframe and return it in an array. i.e. rows become
columns and columns become rows.

@return array
Rotate the dataframe and return it in an array . i . e . rows become columns and columns become rows .