All Questions
Tagged with reshape python-3.x
71
questions
0
votes
0
answers
15
views
Shape issues in Training a Keras Model
Here is the code that I have written:
Df_input = df_close[input_col]
df_Output = df_close[Output_cols]
def preprocess_multistep_lstm(Input_Sequence, Output_Sequence, n_steps_in, n_steps_out, features, ...
0
votes
0
answers
15
views
Is there any xarray code for selecting data in the shape of a parallelogram?
I have a temperature data with dimensions YC and XC. I'm interested in selecting data within the red parallelogram shape depicted in the figure. xarray.DataArray'YC: 720 XC: 560.
However, when using ...
0
votes
2
answers
78
views
Narrow to wide data
I have a following Data frame (df) as shown below:
Is it possible to reshape my (df) into (df1) as shown below:
I have provided a sample of my code, but it does not work.
Appreciate any through or ...
-4
votes
1
answer
429
views
How can I reshape my numpy array from (512) to (512,) in Python 3.x?
I am a new one in python. For maniputing the numpy array, I tried to reshape an array size several times like my expectation. But didn't cover it up.
Currently my array shape is 512
But I want to ...
1
vote
0
answers
84
views
How to submit 3 images to ConvLSTM2D?
I've been tormented all day, I've searched through the whole stackoverflow and haven't found an answer.
When I send one image to the input and output of convlstm2d, I change the structure of the array ...
2
votes
1
answer
76
views
How to remove subarrays containing nan elements on a 3d array preserving the shape?
I have a sparse array of shape (863, 923, 2) that contains lot of NANs:
[[[ 43.06010628 -11.01121568]
[ 25.03068277 16.3949826 ]
[-23.75853158 -10.95350074]
...
[ 25.52110353 3.00428452]
[...
0
votes
1
answer
42
views
Reshaping Panda Data Frame and Create New Columns Based On a Column
I want to reshape a data frame like the following:
df1 = pd.DataFrame( columns=['Serial','Seq_Sp','PT','FirstPT','DiffAngle','R1'],
data=[['1001W','2_1',15.13,15.07,1.9,7.4], ['1001W','...
1
vote
2
answers
20k
views
AttributeError: 'list' object has no attribute 'reshape' when using reshape for a list
according to my code, i want to read the frames and convert them to array. after that using the np.array according below:
img = Image.open(os.path.join(source_folder, item))
frames.append(item)...
0
votes
1
answer
65
views
Reshape the input and output array into fix size
My data has two arrays with input as x and output y as sample is shown below:
x (100,1) y(100,1)
0
-1.04949 0
0.878099 1
0.959288 0
-1.18013 ...
0
votes
1
answer
34
views
How to reshape a list created by web scraping?
I hacked together the code below.
import requests
from bs4 import BeautifulSoup
from pandas import DataFrame
import itertools
import numpy as np
url_base = "https://finviz.com/quote.ashx?t="...
0
votes
1
answer
29
views
Clipping timeseries data to nearest hour or the nearest day
I have a set of 5 time series dataframes with resolution of 15mins but they do not end on the same date and time. However, the starting date and time are same. So, I would prefer to clip them so that ...
1
vote
2
answers
60
views
Spread specific columns in dataframe without any aggregation?
Here is my toy df:
{'id': {0: 1089577, 1: 1089577, 2: 1089577, 3: 1089577, 4: 1089577},
'title': {0: 'Hungarian Goulash Stew',
1: 'Hungarian Goulash Stew',
2: 'Hungarian Goulash Stew',
3: '...
1
vote
1
answer
42
views
Cant pivot pandas dataframe in python
I have a dataframe that I need reshape:
sampl = pd.DataFrame({'ID': '5 6 6 6 6 7 7 7'.split(),
'VarName': 'one one two three two two one three'.split(),
'Value': '...
1
vote
1
answer
86
views
Splitting a matrix into arrays with different column sizes
I want to split a matrix into arrays with different column sizes. I'm able to do it with a for loop, however I'm curious if it could be done in a faster way using some command.
Let's say for example ...
0
votes
2
answers
6k
views
ValueError: cannot reshape array of size 784 into shape (16,16)
While read .mat format data with Python and show as plt:
import scipy.io as spio
import numpy as np
import matplotlib.pyplot as plt
digits = spio.loadmat('./data/digits.mat', squeeze_me=True)
X = ...