Top "Reshape" questions

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

Reshape three column data frame to matrix ("long" to "wide" format)

I have a data.frame that looks like this. x a 1 x b 2 x c 3 y a 3 y b 3 y …

r matrix dataframe plyr reshape
Split delimited strings in a column and insert as new rows

I have a data frame as follow: +-----+-------+ | V1 | V2 | +-----+-------+ | 1 | a,b,c | | 2 | a,c | | 3 | b,d | | 4 | …

r dataframe reshape data-manipulation strsplit
Getting error: Cannot reshape array of size 122304 into shape (52,28,28)

I'm trying to reshape a numpy array as: data3 = data3.reshape((data3.shape[0], 28, 28)) where data3 is: [[54 68 66 ..., 83 72 58] [63 63 63 ..., 51 51 51] [41 45 80 ..., 44 46 81] ..., [58 60 61 ..., 75 75 81] [56 58 59 ..., 72 75 80] [ 4 4 4 ..., 8 8 8]] data3.shape is (52, 2352 ) But …

python numpy image-processing reshape cv2
Pandas long to wide reshape, by two variables

I have data in long format and am trying to reshape to wide, but there doesn't seem to be a …

python pandas reshape
AttributeError: 'Series' object has no attribute 'reshape'

I'm using sci-kit learn linear regression algorithm. While scaling Y target feature with: Ys = scaler.fit_transform(Y) I got …

python python-3.x pandas reshape attributeerror
Reshape of pandas series?

It looks to me like a bug in pandas.Series. a = pd.Series([1,2,3,4]) b = a.reshape(2,2) b b has type …

python numpy pandas reshape
Reshape 3d matrix to 2d matrix

I have a 3d matrix (n-by-m-by-t) in MATLAB representing n-by-m measurements in a grid over a period of time. I …

matlab matrix reshape
How to melt and cast dataframes using dplyr?

Recently I am doing all my data manipulations using dplyr and it is an excellent tool for that. However I …

r reshape dplyr melt
Rearrange dataframe to a table, the opposite of "melt"

I have huge dataframe like this: SN = c(1:100, 1:100, 1:100, 1:100) class = c(rep("A1", 100), rep("B2", 100), rep("C3", 100), rep("D4", 100)) # total 6000 levels …

r dataframe reshape
reshape a pandas dataframe

suppose a dataframe like this one: df = pd.DataFrame([[1,2,3,4],[5,6,7,8],[9,10,11,12]], columns = ['A', 'B', 'A1', 'B1']) I would like to …

python pandas dataframe reshape lreshape