Category "list"

How to sort list of tuples based on variable in tuple

Given a list of tuples in this format (item,[dependency, priority]) where the first element indicates an item, and the first element of the second indicates a d

Can't multiply sequence by non-int of type 'float' ERROR when trying to multiply a float number with len(list)

I'm trying to take a random sample from a list given SPLIT_SIZE = 0.9, but I'm having the following error: TypeError: can't multiply sequence by non-int of type

Flutter; replace item in list

I have a list in my app. It containe a couple of items. I want to replace every item that is equal to a user-input(A String) , with another user-input(Another S

Is there any way to get all ookla server list and store this into a data base?

i wanted to insert all available ookla servers into my data base for the speed test purpose for my android application. But i am not getting any way to find out

Slicing list of lists in Python

I need to slice a list of lists: A = [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]] idx = slice(0,4) B = A[:][idx] The code above isn't giving me the right output. What

Print next element of a list, if it matches the previous element

I have a list with similar elements, and I want to print the next element if I match the previous one. So something like this: my_list=['one', 'two', 'one', 'o

excel/vba: count number of unique male and female students in list

I have a database of students with names and their gender, however the list contains repeats of students on different dates. How do I count the number of uniqu

How to check if a list partially matches one of the lists in a list of lists?

I would like to check if a list is a sublist if a bigger list of lists. It would be easy to check if it is just in the list of lists but a partial match is also

How to check if a list partially matches one of the lists in a list of lists?

I would like to check if a list is a sublist if a bigger list of lists. It would be easy to check if it is just in the list of lists but a partial match is also

finding and replacing elements in a multidimensional list (python)

Similar to this question: finding and replacing elements in a list (python) but with a multi-dimensional array. For example, I want to replace all the N's with

In Python, how to numerically sum nested lists of integers: [[1,0], [1,1], [1,0]] → [3,1]

I have an array in the form of a = [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0]] and I need to sum all values of the same index in the nested lists so that the ab

Removing [' and '] from CSV

I have several GB of CSV files where values in one of the columns look like this: Which is a consequence of this: urls.append(re.findall(r'http\S+', hashtags_r

React native Wifi list

Is there a way to scan and all get Wifi list using react native for Android and iOS. I have seen a few libraries but mostly for android and even those doesnt wo

how do i sort data from a csv file numerically in python

I am writing a program that takes students scores from a csv file and needs to sort then highest to lowest score. the csv file looks like this: josh 12 john

how do i sort data from a csv file numerically in python

I am writing a program that takes students scores from a csv file and needs to sort then highest to lowest score. the csv file looks like this: josh 12 john

How to synchronize to curves on matplotlib?

I have two curves that have their maximum roughly at the same time, but I'd like to match them exactly. The first function, maxind, determines where the maximum

How do I get quarterly S&P500 constituents in Python from the detailed change data?

I want to use S&P500 company information to calculate an index. However, the companies in S&P500 changes frequently, I want to know the constituents for

Write optimized code which takes following two list of dictionaries as input and gives output as final_result [duplicate]

Inputs: list1 = [{'item_type':1,'value':55, 'title':'abc'},{'item_type':2,'value':43, 'title':'def'},{'item_type':3,'value':35, 'title':'ghi'}

List<String> as input of GET method

I have a REST service. The input type of the GET method is List<String>: @GET @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public L

TypeError: list indices must be integers, not float

I have a python 3.x program that is producing an error: def main(): names = ['Ava Fischer', 'Bob White', 'Chris Rich', 'Danielle Porter', 'Gor