Top "Reshape" questions

In R, Matlab, NumPy and APL, reshape functions allow data to be transformed into more convenient forms.

What does -1 mean in pytorch view?

As the question says, what does -1 do in pytorch view? In [2]: a = torch.arange(1, 17) In [3]: a Out[3]: tensor([ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16.]) In [7]: …

reshape pytorch
dcast error: ‘Aggregation function missing: defaulting to length’

My df looks like this: Id Task Type Freq 3 1 A 2 3 1 B 3 3 2 A 3 3 2 B 0 4 1 A 3 4 1 B 3 4 2 A 1 4 2 B 3 I want to …

r data.table reshape reshape2
Pivot Table-like Output in R?

I am writing a report that requires the generation of a number of pivot tables in Excel. I would like …

r pivot-table reshape
Reshaping multiple sets of measurement columns (wide format) into single columns (long format)

I have a dataframe in a wide format, with repeated measurements taken within different date ranges. In my example there …

r reshape tidyr reshape2 r-faq
Convert matrix to three column data.frame

I've got matrix: var1 var2 row1 1 2 row2 3 4 Want to convert it to data.frame: rows vars values row1 var1 1 row1 …

r matrix dataframe reshape
Frequency counts in R

This may seem like a very basic R question, but I'd appreciate an answer. I have a data frame in …

r frequency reshape
Reshape data frame to convert factors into columns in R

I have a data frame where one particular column has a set of specific values (let's say, 1, 2, ..., 23). What I would …

r reshape factors
Why reshape2's Melt cannot capture rownames in the transformation?

I have the following data: Cubn 3.71455160837536 0.237454645363458 Gm9779 2.56051657980096 0.20850752817264 Apod 3.51796703048962 0.195999214485821 What I want to do is to create the 'melted' data such …

r reshape reshape2
Melt the Upper Triangular Matrix of a Pandas Dataframe

Given a square pandas DataFrame of the following form: a b c a 1 .5 .3 b .5 1 .4 c .3 .4 1 How can the upper triangle …

python pandas numpy reshape melt
How does numpy.swapaxes work?

I created a sample array: a = np.arange(18).reshape(9,2) On printing, I get this as output: [[ 0 1] [ 2 3] [ 4 5] [ 6 7] [ 8 9] [10 11] [12 13] [14 15] [16 17]] On executing this reshaping: …

python arrays numpy reshape