Skip to main content

Questions tagged [reshape]

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

0 votes
0 answers
15 views

Unexpected coordinate switching when reshaping object positions into 3D grid after flattening and integrating

I am working on processing and analyzing velocity field data from VTI files using Python. The workflow includes reading VTI files, extracting velocity data, computing object trajectories, generating ...
-3 votes
0 answers
39 views

cannot reshape array of size 1000 into shape (100,100) [closed]

>>> cent_rand = np.random.randint(1919, 3946, 1000) >>> len(cent_rand) 1000 >>> two_d_cent = cent_rand.reshape((100,100)) Traceback (most recent call last): File "<...
0 votes
0 answers
14 views

Why reshape is needed for Sequential models after minmaxscaler class? and how to use?

My recent project is based on 'Stock Prediciton" I'm working on df["Open"] as nd.array. Trying to understand intuitively how this works and whether my predicted data will be correct or ...
1 vote
1 answer
379 views

LSTM Autoencoder set-up for multiple features using Pytorch

I am building an LSTM autoencoder to denoise signals and will take more than 1 feature as it's input. I have setup the model Encoder part as follows which works for single feature inputs (i.e. ...
0 votes
2 answers
33 views

merge multiple DFs based on column names and row names in R [duplicate]

I have 3 Dfs I need to split it based on columns and row names like shown below I tried merge_recurse option from reshape, looks like it merges row by row. Please help me to get the columns added side ...
1 vote
3 answers
58 views

Equivalence between reshape, strides and transpose? (numpy)

i am sorry for the very naive question. I have these lines of numpy code, with a transpose at the beginning, and strides and reshape are used afterward. I wonder if by re-ordering indices in reshape ...
0 votes
1 answer
68 views

reshape problem in LogisticRegression code

I try to make a LogisticRegression. import pandas import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression import numpy as np df = pd.read_csv("tested.csv") df....
1 vote
1 answer
29 views

R issue with reshape, reshape is not ordering columns correctly

I am trying to use reshape function in R to arrange my data timepoints in a table. The variable that I am using to split it is numerical, but when reshape arranges the table it incorrectly puts 2,0.5,...
2 votes
1 answer
24 views

How to subset a melt object

My issue I have melt object from reshape2 library. I would like to subset variables with value==1. However, when I select value from subset melt object, I get the id instead of variable. How to get a ...
1 vote
1 answer
56 views

Reshape Pandas Dataframe and group by 2 level columns

I have a dataframe with flat structure of having unique Rows as follow. I need to reshape it as shown below. Using Pivot table and swapping levels, I managed to obtain somewhat closer to the result, ...
383 votes
15 answers
493k views

How to reshape data from long to wide format

I'm having trouble rearranging the following data frame: set.seed(45) dat1 <- data.frame( name = rep(c("firstName", "secondName"), each=4), numbers = rep(1:4, 2), value = rnorm(8) )...
3 votes
2 answers
1k views

Unstack to top column level

I have the following dataframe: df = pd.DataFrame({'Col1':[10,20,30,40,50], 'Col2':[60,70,80,90,100]}, index=pd.MultiIndex.from_arrays([['A','A','A','B','B'], [1,2,3,4,5]])) I would like to obtain ...
0 votes
1 answer
21 views

Troubleshooting onnxruntime inference - X num_dims does not match W num_dims

Using the nnhash.py script found here: https://github.com/AsuharietYgvar/AppleNeuralHash2ONNX # Copyright 2021 Asuhariet Ygvar # # Licensed under the Apache License, Version 2.0 (the "License&...
0 votes
1 answer
46 views

this code show an reshape error. how fix this?

I'm new in python and ML. I wrote this code for practicing. It displays this error. how do I solve this reshape problem? import pandas as pd import sklearn as skl data=pd.read_csv('housing.csv') ...
2 votes
3 answers
2k views

Getting a tuple in a Dafaframe into multiple rows

I have a Dataframe, which has two columns (Customer, Transactions). The Transactions column is a tuple of all the transaction id's of that customer. Customer Transactions 1 (a,b,c) 2 (...

15 30 50 per page
1
2 3 4 5
261