# math « List « Python Data Type Q&A

Home
Python Data Type Q&A
 1 array 2 date 3 dictionary 4 Format 5 integer 6 List 7 numpy 8 regex 9 string 10 tuple
 Python Data Type Q&A » List » math

### 1. remove numbers from a list without changing total sum    stackoverflow.com

I have a list of numbers (example: `[-1, 1, -4, 5]`) and I have to remove numbers from the list without changing the total sum of the list. I want to ...

### 2. Fastest way to list all primes below N in python    stackoverflow.com

This is the best algorithm I could come up with after struggling with a couple of Project Euler's questions.

``````def get_primes(n):
numbers = set(range(n, 1, -1))
...``````

### 3. Python - How to find a correlation between two vectors?    stackoverflow.com

Given two vectors X and Y, I have to find their correlation, i.e. their linear dependence/independence. Both vectors have equal dimension. The result should be a floating point number ...

### 4. Math in python - converting data files to matrices    stackoverflow.com

Today, as I tried to put together a script in Octave, I thought, this may be easier in python. Indeed the math operators of lists are a breeze, but loading ...

### 5. Algorithm to find which number in a list sum up to a certain number    stackoverflow.com

I have a list of numbers. I also have a certain sum. The sum is made from a few numbers from my list (I may/may not know how many numbers it's ...

### 6. Reordering python list based on an algorithm or pattern    stackoverflow.com

Here is a stumper for you math geeks out there. I have a python list that is just a sequence that looks like this:

``````myList=[1,2,3,4,5,6,7,8,9,10,11,12,13,(...etc...),43]
``````
Unfortunately, the data from which the list ...

### 7. Finding the outer borders from the list of random coordinates    stackoverflow.com

I've a huge list (60 000+) of coordinates and I haven't found a way for recognizing the outer borders. The list of coordinates are quite random, but they're defining some really specific ...

### 8. Doing math with Python lists    stackoverflow.com

I have output like this:

``````LL= [['a', 2, 3, 4, 13], ['b', 6, 7, 8, 13], ['c', 10, 11, 12, 13]]
``````
Instead of "13", I would like to get maximum of elements ...

### 9. distance formula between two points in a list    stackoverflow.com

I need to take this list I have created and find the closest two points and print them out. How can I go about comparing each point in the list. New ...

### 10. Doing math to a list in python    stackoverflow.com

How do I, say, take `[111, 222, 333]` and multiply it by 3 to get `[333, 666, 999]`?

### 11. List coordinates between a set of coordinates    stackoverflow.com

This should be fairly easy, but I'm getting a headache from trying to figure it out. I want to list all the coordinates between two points. Like so: 1: (1,1) 2: (1,3) In between: ...

### 12. How to improve my performance in filling gaps in time series and data lists with Python    stackoverflow.com

I'm having a time series data sets comprising of 10 Hz data over several years. For one year my data has around 3.1*10^8 rows of data (each row has a time ...