Skip to main content

Questions tagged [reshape]

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

reshape
613 questions with no upvoted or accepted answers
8 votes
0 answers
10k views

Tensorflow Dimension size must be evenly divisible by N but is M for 'linear/linear_model/x/Reshape'

I've been trying to use tensorflow's tf.estimator, but I'm getting the following errors regarding the shape of input/output data. ValueError: Dimension size must be evenly divisible by 9 but is 12 ...
Mirodil's user avatar
  • 2,320
7 votes
1 answer
2k views

Melt datafarame with certain order in R

I am trying to melt this dataset: raw1 <- c("Alpha", "2018-04-01", "566.0", "647.75", "669.08", "673.08", "675.00") raw2 <- c("Alpha", "2018-04-02", "563.3", "651.08", "670.67", "684.58", "671....
alvaropr's user avatar
  • 759
7 votes
0 answers
1k views

Incorrect reshape of vtk->numpy array?

I am reading VTK uniform grid into python. When I visualize a slice through the data in Paraview, I get the following (correct) image: Then I visualize the slice using via numpy & pylab using the ...
eudoxos's user avatar
  • 18.9k
3 votes
0 answers
152 views

what is the correct method to match channel shape in cnn? transpose vs reshape

I tried to build my CNN layer. but I had one problem. The CNN layer's input is image data. and I used to the backend as TensorFlow. so the CNN layer's input shape must be (number of data, height, ...
POEY's user avatar
  • 83
3 votes
0 answers
490 views

SQLite reshape long to wide for many keys

I want to to convert data from long to wide format in SQLite, when the number of keys (to-be columns) is very large. There are two relevant questions, one that provides a very good answer fro MySQL (...
User800701's user avatar
3 votes
1 answer
230 views

is it possible to track the progress of a function like melt in package reshape?

I am aware that I can create a progress bar for a self-created loop or something like that. However, is it possible to somehow keep a track of the progress for a function like melt() from the reshape ...
Lucie's user avatar
  • 31
3 votes
1 answer
759 views

Unstacking a Pandas dataframe when one column has some NaN entries

I have a Pandas DataFrame for which I am pivoting some row entries into columns, using the unstack() method (as advised in this question). To do so, I set_index with the unpivoted columns, and then ...
Brian B's user avatar
  • 1,430
3 votes
0 answers
3k views

reshape2 dcast error on large dataset

I have a dataset of columns search_query[factor], movie_name[factor], clicks[int] with about 1,800,000 rows. When I use the dcast function from the reshape2 package to try to create a matrix from ...
user1460878's user avatar
2 votes
1 answer
18 views

Is there a simple way to conduct the this transformation on a multi-indexed dataframe?

Please see the attached image showing a DataFrame (left_table in the picture, wrote this as a code in the following). I want to transform it to the right_table in a simple way (using pivot, melt, ...
saman taheri's user avatar
2 votes
0 answers
4k views

WARNING:tensorflow:Model was constructed with shape (None, None) for input KerasTensor

WARNING:tensorflow:Model was constructed with shape (None, None) for input KerasTensor(type_spec=TensorSpec(shape=(None, None), dtype=tf.float32, name='embedding_2_input'), name='embedding_2_input', ...
DavidGlay's user avatar
2 votes
1 answer
49 views

How to pivot_wider while preserving duplicate column values?

looking for some help on this maybe basic issue. Suppose I have the following: tibble( x= c("a","a","b","b","b","b"), y= c(1,2,1,2,1,2) )...
acko's user avatar
  • 21
2 votes
0 answers
323 views

Using a multiple matrices to predict a matrix in Python with Keras

I modified the code from here. What I'm trying to do is combine the two matrices to predict the output matrix. The output matrix is built from the two input matrices. The problem seems to be ...
Brian Droncheff's user avatar
2 votes
0 answers
231 views

Visualize coordinates in txt file, Python

I have txt file. Every line has 11 elements. Below is shown the file. 4.05010767925,2.33864731895,2.41543839929,3.86018471931,0.481566107186,4.85262264971,3.83877010346,-0.89860066431,1.97925697639,4....
Timon's user avatar
  • 61
2 votes
0 answers
411 views

Reshape 4D Numpy Image data

I had 4 RGB images in an array of shape (4,32,32,3). Then I divided these images in 16 equal 8x8 blocks (64 represents the 8x8 block), decoded_imgs.shape = (4,16,64,3) , 3 represents the colour ...
Laiba Ch's user avatar
2 votes
2 answers
55 views

How to transform from long to wide data set in r by creating means

I have the following data set: Email Relationship Q1 Q2 Q3 Q4 1 [email protected] Self 1 2 2 3 2 [email protected] Peer 3 3 4 5 3 sample@...
Sarita Upadhyay's user avatar

15 30 50 per page
1
2 3 4 5
41