0 votes

I wanted to ask that the following code doesn't work

`c=vstack(tsne_data,label_1000).T`

where shape of tsne_data is (1000,2) and the shape of label_1000 is (1000,)

but the following code works for the same

`c=vstack(tsne_data.T,label_1000).T`

for the same shape of tsne_data and label_1000

so I wanted to know that why do we need to use transpose with tsne_data in vstack

Jul 30, 2019 in Python 903 views

## 1 answer to this question.

0 votes

The vstack function in numpy will stack the sequence vertically (row wise).

If you see the below example shape of the row in a and b are not similar so you won't be able to add b to a.

In order to do that you will have to find the transpose of it so that shape of rows in a and b are similar

answered Jul 30, 2019 by Esha

0 votes
1 answer

## Dimension in python numpy

Use the .shape to print the dimensions ...READ MORE

0 votes
1 answer

## Numpy data in csv

Use this -  numpy.savetxt("data.csv", arr, delimiter=",") READ MORE

0 votes
1 answer

## Mean and average in numpy

np.average() can be used to calculate weighted ...READ MORE

0 votes
1 answer

## In NumPy how do I get the maximum of subsets? Python

You can use np.maximum.reduceat: >>> _, idx = np.unique(g, ...READ MORE

0 votes
1 answer

## Is it possible to invert a Numpy boolean array in Python using the tilde operator (~)?

Good question, glad you brought this up. I ...READ MORE

0 votes
1 answer

## How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

0 votes
1 answer

## Count the digits in a Numpy array

Hey, @Sourav, We can solve this with the ...READ MORE

0 votes
1 answer

## How to save numpy array?

Hi@akhtar, You can use numpy.save() function to save ...READ MORE

0 votes
1 answer

## Is there a string 'contains' in python?

In this case, you can use the ...READ MORE

0 votes
1 answer

## how to manage memory in python?

Memory management in python involves a private heap ...READ MORE