Top "Reshape" questions

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

Converting a numeric matrix into a data.table (or data.frame)

Hoping there's a simple answer here but I can't find it anywhere. I have a numeric matrix with labelled rows …

r dataframe transformation data.table reshape
pandas pivot table to data frame

I have a dataframe (df) that looks like this: +---------+-------+------------+----------+ | subject | pills | date | strength | +---------+-------+------------+…

python pandas reshape
stacking columns into 1 column in R

I have a data frame that looks like: ID Time U1 U2 U3 U4 ... 1 20 1 2 3 5 .. 2 20 2 5 9 4 .. 3 20 2 5 6 4 .. . . And I would need to keep …

r dataframe rows reshape
How do I resize a matrix in MATLAB?

Suppose I had a 1-by-12 matrix and I wanted to resize it to a 4-by-3 matrix. How could I do …

matlab matrix reshape
Reshaping wide to long with multiple values columns

I need to reshape my wide table into long format but keeping multiple fields for each record, for example: dw &…

r reshape reshape2 melt
R reshape a vector into multiple columns

Let's say I have a vector in R as follows: d<-seq(1,100) I want to reshape this vector into …

r vector matrix reshape reshape2
Reshape multiple value columns to wide format

I have the following data frame and i want to use cast to create a "pivot table" with columns for …

r reshape r-faq
pandas pivot_table column names

For a dataframe like this: d = {'id': [1,1,1,2,2], 'Month':[1,2,3,1,3],'Value':[12,23,15,45,34], 'Cost':[124,214,1234,1324,234]} df = pd.DataFrame(d) Cost Month Value id 0 124 1 12 1 1 214 2 23 1 2 1234 3 15 1 3 1324 1 45 2 4 234 3 34 2 to which …

python pandas pivot-table reshape
can the value.var in dcast be a list or have multiple value variables?

In the help files for dcast.data.table, there is a note stating that a new feature has been implemented: "…

r data.table reshape reshape2
Subsetting R data frame results in mysterious NA rows

I've been encountering what I think is a bug. It's not a big deal, but I'm curious if anyone else …

r subset reshape na