Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 53603

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.

1 vote
1 answer
292 views

Implementation of a beta-binomial test in Python

I have been unable to find a Python function for performing beta-binomial test. …
Dataman's user avatar
  • 227
3 votes
2 answers
90 views

Determining the value of a position on an array based on its nearest datapoint known value

I was wondering what would be the efficient way to determine the value of a position on an array based on its nearest datapoint known value in Python? …
Dataman's user avatar
  • 227
1 vote
Accepted

Determining the value of a position on an array based on its nearest datapoint known value

I think that the following code answers my question: import numpy as np indices = np.around(np.array(positions) / step).astype(int) for idx in indices: n.append(values[idx]) EDIT I came up wit …
Dataman's user avatar
  • 227
2 votes
2 answers
3k views

Extracting maximum values from each of the subsets of an array

Problem description: I have a numpy array cps from which I want to extract the maximum value in each of the subsets of the array (a subset is defined as non-zero values which fall between zeros). The …
Dataman's user avatar
  • 227
1 vote
Accepted

Extracting maximum values from each of the subsets of an array

I found a neat way to do the trick by using the argrelmax() function from scipy.signal module. It seems that it does not increase the performance in my code, however, the code becomes more readable. …
Dataman's user avatar
  • 227
4 votes
1 answer
437 views

Bernoulli trials using a condition in a vectorized operation

I was wondering how to vectorize the following code instead of using the for-loop and still be able to check for a condition. # n is a numpy array which keeps the 'number of trials' parameter for the …
Dataman's user avatar
  • 227