Tagged Questions

1
vote
4answers
2k views

Python/NumPy first occurrence of subarray

In Python or NumPy, what is the best way to find out the first occurrence of a subarray? For example, I have a = [1, 2, 3, 4, 5, 6] b = [2, 3, 4] What is the fastest way (run-time-wise) to find ...
1
vote
1answer
2k views

Python/Numpy - Extract a 2-d Sub-array from a 2-d array using variables

Ok, So I have a 2-d array of data which has the shape(23025, 1000), it's called 'allfiles'. I need to go through the array 50 columns at a time and extract them to a sub-array for manipulation. The ...
0
votes
2answers
228 views

“Splitting” the output of a RLE (groupby) depending on a defined value ( the “character” to split the RLE on )

Consider the "string" ( treat it as an array of digits ) 0 0 1 8 8 8 1 0 The RLE ( "groupby" ) is: [(0,2), (1, 1), (8,3), (1, 1), (0, 1)] We then enrich the above RLE with the sum of the run ...
0
votes
2answers
564 views

Calculating conditional probabilities from joint pmfs in numpy, too slow. Ideas? (python-numpy)

I have a conjunctive probability mass function array, with shape, for example (1,2,3,4,5,6) and I want to calculate the probability table, conditional to a value for some of the dimensions (export the ...