Issue I pretend to remove slices from the third dimension of a 4d numpy array if it’s contains only zeros. I have a 4d numpy array of dimensions [256,256,336,6] and I need to delete the slices in the third dimension
Continue readingTag: numpy-ndarray
[SOLVED] subtracting unmatching column from two dataframe in python
Issue I have two dataframes(missingData and bias) and one Series(missingDateUnique). missingDateUnique = pd.Series({0: 2459650, 9: 2459654}) missingDate = pd.DataFrame({0: [2459650, 2459650,2459650,2459654,2459654,2459654], 1: [10, 10,10,14,14,14]},index=[0,1,2,9,10,11]) bias = pd.DataFrame({0: [2459651, 2459652,2459653,2459655,2459656,2459658,2459659], 1: [11, 12,13,15,16,18,19]}) As missingDateUnique values are not in bias dataFrame.
Continue reading[SOLVED] Load all mat files from subdirectories
Issue I have lots of data in .mat format. Moreover, my main data folder has lots of subfolders. Under each subfolders, I have 1000 .mat data files. I want to load all of them by using python. I am trying
Continue reading[SOLVED] How to declare numpy array of particular type as type in dataclass
Issue What I have: I am creating a dataclass and I am stating the types of its elements: class Task(): n_items: int max_weight: int max_size: int items: numpy.array(Item) # incorrect way of doing it What I want to do I’d
Continue reading[SOLVED] Find most frequent value per coordinate in multiple 2d Arrays
Issue I have multiple 2d arrays like this for example: A = [[-1, -1, 0, 1, -1], [1, 1, 0, -1, -1], [-1, -1, -1, -1, -1], [-1, 1, -1, -1, 0]] B = [[-1, -1, 0, 1, -1], [1,
Continue reading[SOLVED] How to preserve column order after applying sklearn.compose.ColumnTransformer on numpy array
Issue I want to use Pipeline and ColumnTransformer modules from sklearn library to apply scaling on numpy array. Scaler is applied on some of the columns. And, I want to have the output with same column order of input. Example:
Continue reading[SOLVED] Elegant solution in python to extract data and put them under a basic array format
Issue I put the 2 first vectors of output data file that I got with wolfram Mathematica : (* Created with the Wolfram Language for Students – Personal Use Only : www.wolfram.com *) {{0.29344728841663786, 0.00037262711145454893, 0.7061800844719075, 67.41431300170986, 1.3887122472912174, 0.0014182932914303275, 500.97644711373647,
Continue reading[SOLVED] Fastest way to get dot product of a matrix and each point in the given array
Issue I have an array Nx3 of N points, each one has X, Y and Z coordinate. I need to rotate each point, so i have the rotation matrix 3×3. To do this, i need to get dot product of
Continue reading[SOLVED] Facing issues when converting a matrix in matlab into numpy assray in python
Issue I have converted a .m file into a python file. The .m file consists of a matrix; which is a function of a variable called ‘f’. Now I wanted to convert this matrix into numpy array, so that I
Continue reading[SOLVED] Merge two NumPy arrays into one
Issue Say I have the following two arrays, a and b: import numpy as np a = np.array([[[1, 0], [1, 1]], [[1, 0], [0, 0]], [[0, 0], [1, 0]]]) b = np.array([[[0, 2], [0, 0]], [[0, 0], [0, 2]], [[0,
Continue reading