Skip to main content

All Questions

0 votes
2 answers
118 views

Comparing Columns , Arrays, List using SQL, Numpy or Python List. Would Intertools be valid alternative and faster?

I have two table in SQL tModel which has 9 columns (ID, Date N1, N2, N3, N4, N5, N6, Flag) and 300 million rows tPairAP which has 3 columns (ID, N1, N2) and 750 rows The task I need to to perform is ...
Marco_sbt's user avatar
  • 327
1 vote
1 answer
137 views

Efficiently find full row permutations in 2d array having repeated row pairs

Consider the array: import numpy as np import numpy_indexed as npi from itertools import permutations arr = np.array([[1, 2, 3, 4], [3, 3, 3, 6], [2, 0, 0, 2], ...
user109387's user avatar
0 votes
0 answers
48 views

Combining group of arrays and minimize resulting negative elements

Problem: Given a set of G groups, each of them with a set of n_i int-arrays with a fixed length t: Find the combinations of arrays (variable length, from 1 to G), so the resulting sum-array contains ...
user2878268's user avatar
1 vote
2 answers
66 views

How to group items in list in python if the value change? [duplicate]

Suppose I have a list msg_type =["sent-message", "received-message", "received-message", "sent-message", "received-message", "sent-message", ...
Sanket Wagh's user avatar
0 votes
1 answer
100 views

Python 3sum solution using itertools module exceeds time limit

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not ...
Mubarak Ajibola Odufade's user avatar
0 votes
2 answers
162 views

How do I implement a python dictionary with combinations so that it returns keys as indices and values as the value of the element?

I'm trying to find 2 numbers(n=2) in the array that add up to 3 and print the tuple. In this example the output should be {0:1,1:2}. Currently I have the output to be true or false but I want it to ...
prodoto's user avatar
3 votes
3 answers
3k views

Create all possible combinations of lists of different sizes in numpy

I want to create a numpy array with all possible combinations of items from multiple lists of different sizes: a = [1, 2] b = [3, 4] c = [5, 6, 7] d = [8, 9, 10] In each combination, I want 2 ...
gimi's user avatar
  • 425
0 votes
1 answer
161 views

Insert 1D array into a 2D array

I am trying to insert a column into a 2D array. Currently I have a 2D array generated using itertools. sample_points=[-1.5, -.8] base_points = itertools.combinations_with_replacement(sample_points, 3) ...
eeqesri's user avatar
  • 261
2 votes
1 answer
338 views

Use dask for an out of core conversion of iterable.product into a numpy/dask array (create a matrix of every permutation with repetition)

I am looking to create a matrix (numpy array of numpy arrays) of every permutation with repetition (I want to use it for matrix multiplication later on). Currently the way I am doing it, I first ...
Ivan 's user avatar
  • 73
3 votes
1 answer
3k views

How to get all combination for a given sum with a given number of elements

I have a list of list of floats like this numbers = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] I want a python code that can generate all possible combinations for given sum (=1) and a given number of ...
ProgrX's user avatar
  • 141
1 vote
2 answers
98 views

Differences in an array based on groups defined by another array

I have two arrays of the same size. One, call it A, contains a series of repeated numbers; the other, B contains random numbers. import numpy as np A = np.array([1,1,1,2,2,2,0,0,0,3,3]) B = np.array([...
FDP's user avatar
  • 13
0 votes
1 answer
26 views

Is there another different way of printing a cartesian product in a dictionary which has arrays as values following an specific order on Python?

Let's say I have the following dictionary: the_dictionary_list = {'Color': ['Amarillo.png', 'Blanco.png', 'Rojirosado.png', 'Turquesa.png', 'Verde_oscuro.png', 'Zapote.png'], '...
NoahVerner's user avatar
0 votes
1 answer
2k views

How can I obtain all combinations of my list?

I am attempting to create an array with all the possible combinations of two numbers. My array is [0, 17.1] I wish to obtain all the possible combinations of these two values in a list of 48 elements ...
Aidan Donnelly's user avatar
0 votes
2 answers
1k views

All Possible Combinations from an array with boundary conditions in Python?

I have a list of 4 items, and I would like to find all possible combinations of these 4 items for a given array length. Ex: if I specify that I want the length to be 16, I want to generate all ...
user14262940's user avatar
2 votes
1 answer
482 views

Retrieve all possible combinations of ascending integers from sublists

I have lists containing sublists. From theses lists I want to retrieve all combinations of integers that are in ascending order. Also the order of the sublists is important (see expected output). It ...
chatax's user avatar
  • 998

15 30 50 per page