Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
131 views

Minimum re-labeling to make an array as close as possible to another one

I have an array with integer labels in [0, n-1], say arr1=[1, 0, 3, 2] with n = 3. And then I have another array again with integer labels in [0, n-1], say arr2=[0, 0, 2, 3]. How can I find the ...
ApPs's user avatar
  • 23
1 vote
1 answer
755 views

Calculating all combinations from arrays AND (arrays OR floats)

Context: My question comes from needing to iterate different np.arange arrays. The main motivation is to calculate all the possible combinations between the arrays, ...
nuwe's user avatar
  • 163
2 votes
1 answer
1k views

Fast brute force numpy array combination

I want to extract the combinations of numpy arrays in this way: ...
snowflake's user avatar
  • 275
4 votes
1 answer
3k views

Permutations with a sum constraint

I have made the following function that gives the combinations permuted of n elements with a constrain/rule. This consist on creating a dataframe with all combination of numbers from 0 to n that sums ...
PeCaDe's user avatar
  • 143
11 votes
2 answers
532 views

Approximate (250 over 100) permutation best fitting certain criteria

Given a list of 250 words of 4 letters each, what is the fastest way, in Python, to find a subsample of 100 words (drawn without replacement) so that the distribution of letters across the whole ...
jona's user avatar
  • 305
1 vote
1 answer
10k views

Fastest way for working with itertools.combinations

I need to speed up the function below: ...
querzy's user avatar
  • 13