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
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
2 answers
312 views

Python itertools.combinations: how to obtain the indices of the combined numbers within the combinations at the same time

According to the question presented here: Python itertools.combinations: how to obtain the indices of the combined numbers, given the following code: import itertools my_list = [7, 5, 5, 4] pairs = ...
Maf's user avatar
  • 734
4 votes
5 answers
136 views

Python | How to group value to different lists from a main list given a certain range of number for each index

OGlist = [A, B, C, D, E, 1, 2, 3, 4, 5, F, G, H, I, J, 6, 7, 8, 9, 10] _list = [] _list2 = [] So, I have a list OGlist... I want the first 5 elements of the OGlist into _list , the second 5 elements ...
user avatar
3 votes
2 answers
1k views

Grouping the nearest elements from a list in terms of difference

I have a list below: tst = [1,3,4,6,8,22,24,25,26,67,68,70,72] I want to group the elements from above list into separate groups/lists based on the difference between the consecutive elements in the ...
sharathchandramandadi's user avatar
2 votes
4 answers
1k views

repeating a numpy array a specified number of times for itertools

I am trying to write some code that will give me the itertools product, for a varying number of inputs. For example, this works for me. test = np.array([x for x in itertools.product([0,2],[0,2],[0,2])...
user14241's user avatar
  • 748
0 votes
2 answers
71 views

using python.itertools to sum slots across multiple lists

I have this: [ [ [1,1,1,0,0,0,0], [0,1,2,3,4,5,6], [1,2,3,4,5,6,7], [2,3,4,5,6,7,8], [3,4,5,6,7,8,9], [4,5,6,7,8,9,0] ] , [ [2,2,2,0,0,0,0], [0,1,2,3,4,5,6], [1,2,3,4,5,6,7], [2,3,4,5,6,7,8],...
Dewey's user avatar
  • 776
-3 votes
1 answer
141 views

Python: 2-item combinations from list of lists containing 1 or more items [closed]

I want to find all 2-item combinations from a list of lists. The inner lists contain one or more items, and I don't want to include combinations of items within the same inner list (unless that ...
Abundnce10's user avatar
  • 2,230