Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [list]

The list tag may refer to: a linked list (an ordered set of nodes, each referencing its successor), or a form of dynamic array. Not to be used for HTML lists, use [html-lists] instead.

0
votes
0answers
4 views

How to assign the elements to different subsets according to the number of letter “A” within the element in R?

I want to assign my data into different groups depends on the number of letters "A". For example, library("stringr") data1 <- c("apple","appreciate","available","account","adapt") data2 <- c("...
1
vote
0answers
15 views

ValueError when trying to create a DF out of two lists with the same length [duplicate]

I have 2 different lists of lists A and B. print(len(A)) 288 print(len(B)) 288 Making them flat: flat_list = [item for sublist in A for item in sublist] flat_list2 = [item for sublist in B for item ...
1
vote
2answers
38 views

Need suggestion about the name of the class

There is some object say, ABC, which I get in different ways. I have added all these methods to get the object ABC in a separate class. Now my question is how should I name this class? I have named it ...
-1
votes
2answers
20 views

Iterating string elements in a list and appending a portion of that string into an empty list

In the code below there is a transaction list containing the name , price , color and the date of a transaction . I want to append the names say 'John', 'Jay' in the customers list , the price say $1....
1
vote
2answers
41 views

Is there a Map object with takes index and key and object? Java

I'm trying to emulate a rotor of an enigma machine in Java. I need an object which takes an index, a key and an object, because I unsuccessfully tried HashMaps like this: private HashMap<Integer,...
-2
votes
1answer
33 views

How to pass list of pairs to a function from a list comprehension?

I have a list of pairs: List_Pairs = [ ['Eat at Joe's', 'Eat my shorts'], ['Eat well', 'Eat mama's pies']...] I have a function that compares the similarity between a pair of sentences and returns a ...
0
votes
1answer
13 views

coldfusion9: find and display file(s) by name

I have a directory with the following files: 1245_cat.txt 6356_cat.txt 3564_it.txt 9867_it.txt 8437_xp.txt 6252_xp.txt I am looking for a way to search and display file(s) based on partial name. For ...
0
votes
3answers
50 views

how to compare order of two list when one list is not stable

I have some string objects which I store inside a List, for example : [US, CN , IN, EN, FR, GR, PL, MX] and the order of the expected list should be same as above list all the time. but the catch ...
0
votes
1answer
26 views

Problems while i'm trying to print a list

I am stuck in a problems with lists, the problem is that when i am trying to print the entire list it prints only the first node, the main goal is to have in tha main.c with only the call to the ...
0
votes
0answers
25 views

put values in single columns after pd.DataFrame.from_dict [duplicate]

I have a dataframe created with pd.DataFrame.from_dict the result looks something like this: a b 0 [0.042167, 2.913] [0.042168, 0.245] 1 [0.042164, 1.739]...
0
votes
2answers
9 views

GET not showing the objects Posted which is implemented in java dynamic web project

I am implementing(in eclipse) a simple way to put and get using my java api. The code is as follows: @Path("/jason") public class JavajsonRestApi { List<Book> bookList = new ArrayList<&...
1
vote
2answers
21 views

how to revert the result in hashmap key&value in groovy

from the hashmap "hash1", I don't reach to obtain the result "hash2" in groovy: hash1 = [a:['a1','b1','c1'],b:['a1','b1','c1','d1']] hash2 = [a1:['a','b'],b1:['a','b'],c1:['a','b'],d1:['b']] Can ...
-1
votes
1answer
41 views

python TypeError with lists

Why am I getting the error "TypeError: list indices must be integers or slices, not str"? But if I change the values in the list to integers, wouldn't doing items.remove(items[1]) just remove the item ...
0
votes
1answer
26 views

Python console classifies my output result as tuple instead of list

Whenever I use the find_match_column() function, the python console show me that all result is a tuple,even though they look like list to me. What should I do to make the result become list? My Text ...
0
votes
1answer
44 views

C# list side by side Design

I have to display these lists side by side in a Console application. List<string> iteamName = new List<string>(); // A list of iteams List<double> priceOfIteam = new List<...
1
vote
1answer
18 views

Why can't I fill sumcount in Counting Sort using list comprehension?

When I use proper looping it works fine. But when I do the exact same thing using list comprehension, it prints nonsense. I have included the looping's code as comments, if anyone wants to take a ...
0
votes
1answer
23 views

Add value for key in dictionary which is inside the list in python

I have to prepare JSON files to send using POST, but I have faced the following format to handle: offer { "location": { "city": "Kharkov", "address": "street" ...
4
votes
6answers
68 views

How to join list of integers into one integer python

Given a list of hex integers, I want to end up with one hex integer where the integers are treated as most-significant first and least-significant last. For example, given... [0x1A, 0xF3, 0x74, 0xA3] ...
0
votes
1answer
18 views

Passing only populated lists to for loop

I have four lists: list1=[1,2,3,4,5,6,7,8,9] list2=['a','b','c','d','e','f'] list3=['one','two','three','four','five','six','seven'] list4=[] I am trying to run the following code to generate all ...
2
votes
1answer
23 views

how to make a control in listTile with flutter

how to make a control in a lisTile with flutter. i get datas from json and display them in a listTile,. but i want to make a if control to show a button. if(data[position]['value'] == 0){ sho ...
-1
votes
1answer
49 views

String Value Isn't Updating

So I've been working on reworking Hangman in Python and I've run into an issue. The output isn't updating at all. It always remains this mesh of underscores, although other parts of the code, such as ...
1
vote
0answers
13 views

best way to store list of blobs with corresponding points

What’s the best way to store blobs detected in an image together with their corresponding pixels (points)? List of Lists? ArrayList? This is what I‘d like to end up with: Blobs[0] .... Blobs[x] ...
0
votes
1answer
14 views

Max within a list conteining 2 equal elements

my question is the following: I am using the code set eumax max ( list eu0 eu1 eu2 eu3 eu4 eu5 eu6 eu7 eu8 eu9 eu10 ) to pick the maximum value within the list, but how does Netlogo pick a value if ...
0
votes
0answers
12 views

Expecting an external pointer: [type=list]. R code

I have a problem with R code: -I have this code line mx.exec.update.arg.arrays(exec_D, arg.arrays = list(data=D_values_fake,label=mx.nd.array(rep(0, batch_size))), match.name=TRUE) where exec_D ...
0
votes
1answer
69 views

Array to List converting and type casting

Motive: Im creating an android Application that does the following. Reads input points (of type Point - a custom class). Calculates the outermost points. Draws a polygon (needs input of type ...
1
vote
3answers
38 views

Replace a certain value at a certain place in a text file in Python

I want to code something that will replace a certain value, on a certain line, in a text file (thefile.txt). I've searched for a long time a solution to my problem but didn't found it. Here is the ...
-3
votes
0answers
32 views

Function for modify a simple python list's item

How can I change the list with other text by using a function? def changename(name): name=["Happy"] print(name[0]) changename("Sad") Like above example I need to change the name[0] in the ...
1
vote
4answers
41 views

iterating over list with different elements

I have three types of element: a dict, a list with one dict, and a list with multiple dicts. a = {"foo":1} b = [{"foo":2}] c = [{"foo":3}, {"foo":4}] list = [a, b, c] I want to be print all four ...
0
votes
0answers
31 views

PHP: sort array according to another array (not same length)

I want to sort an array according to another arrays order. $my_array is not always the lame length as the $order_array. Note: that it is not a case of sorting alphanumeric (e.g. 11 is after 35 in the $...
2
votes
2answers
45 views

How to sum the value for certain condition in R? [on hold]

I have a lot of lists and I want to sum the min value of each list which the min value is less than 3. For instants, a <- c(3,4,1,5,6) b <- c(2,1,1,0,5) c <- c(6,7,5,4,4) list1 <- list(a,...
-2
votes
1answer
22 views

Combine all printed string get from text file in to one list

I am trying to Combine all printed string get from text file in to one list My Textfile: https://drive.google.com/open?id=18tYvYs43vA7ib3br1h1VD75OUU5ho1u8 My Full Code: allinstall = open("...
-1
votes
1answer
38 views

Converting two lists into dictionary error

Hi I tried to convert two lists into a dictionary, it worked before.. However, after cleaning the lists data, when I try to convert them into a dictionary, the lists become 'NoneType' and gives me ...
0
votes
1answer
25 views

Beautifulsoup remove pages numbers at bottom

I'm trying to remove the page numbers from this html. It seems to follow the pattern '\n','number','\n' if you look at the list texts. Would I be able to do it with BeautifulSoup? If not, how do I ...
0
votes
2answers
30 views

Sorting of list in Python by integer in descending order [duplicate]

I have a Python list created with fuzzywuzzy result=[(fuzz.WRatio(n, n2),n2,sdf.index[x],bdf.index[y]) for y, n2 in enumerate(Col2['name']) if fuzz.WRatio(n, n2)>70 and len(n2) ...
-1
votes
0answers
39 views

How to repeat a process of list in For loop with Python?

I have a Python file which run with a json file. The test.py execute the aaa.exe, bbb.exe ... ddd.exe files one by one. After one "exe" file has finished the process, it will create a "result.html". ...
0
votes
1answer
109 views

Generic Bases, Covarience

I have a generic base class from which other generic classes inherit: public class B<T> { private List<T> parent; public bool IsInParent() { return parent.Contains(this); } ...
0
votes
4answers
19 views

Python get key values for keys in list

How can I get key values from a dictionary, for the keys that are in a list. For eaxmple, given a dictionary: d = { 'a': 1, 'b': 2, 'c': 3 } and a list: l = ['a', 'c'] I would like output: ...
1
vote
1answer
59 views

How to moderate elements of a list while in a loop

How do I make sure that the elements in b don't go below 0 or above 10? I.e. when 5 decreases to 0 in list b, how can I get the program to increase it back to 1 and then make increments of 1? a = [...
0
votes
2answers
55 views

Creating Array from type object

I am trying to create an array of the type that is known and currently set to Type. I have been able to create an IList of the type but I am still able to convert that to an array of the type, getting ...
0
votes
0answers
34 views

Malloc for structs - C [duplicate]

I am learning linked lists and when allocating memory for structs, I've seen 2 ways to do it. After testing, both work and I wonder what the first option really does. Here is the code: typedef struct ...
0
votes
2answers
35 views

What the the variables in following program stores?

total_item([],0). total_item([_|Rest],N) :- total_item(Rest,C), N is C+1. This program takes an array as input and count the total number of item in that list. But I am not getting what exactly ...
-4
votes
0answers
40 views

My code has wrong iteration with None [on hold]

I have a problem about iteration of function list I think map function call element of function list with iteration but result value is 'None' I'm wondering why result value is None. thanks def mul(...
1
vote
3answers
70 views

Dynamically create new List<strings> and add n number of lines - C#

I'm trying to read a file using StreamReader. The file contains the data below (and 40,000 more lines!): Tyndall Centre grim file created on 22.01.2004 at 17:57 by Dr. Tim Mitchell .pre = ...
0
votes
0answers
19 views

combine two lists of dicts on one common field in python

Suppose i have one dict of orders [{'order_id': 1, 'vendor_id':1},{'order_id':2, 'vendor_id':3}] and another of vendors [{'vendor_id': 1, 'name', 'vendor 1'},{'vendor_id': 2, 'name', 'vendor 2'},{'...
0
votes
3answers
34 views

Stop adding to List<String> when line matches regex - C#

I've got a StreamReader which is reading lines from a file. Tyndall Centre grim file created on 22.01.2004 at 17:57 by Dr. Tim Mitchell .pre = precipitation (mm) CRU TS 2.1 [Long=-180.00, 180.00]...
-2
votes
4answers
35 views

Combine cells from one column into one string

df = pd.read_csv(filename.csv) corpus = df.corpus How can I combine series of text strings (from one column) into a list? from column 'corpus': row 1: Hail Mary. row 2: Hi Bob. row 3: Hey Sue. ...
-2
votes
1answer
52 views

Why is stack for pair-nesting analysis often empty?

The following is my code where I try to check for the balanced parenthesis. def is_matched(expression): opening = tuple('({['); closing = tuple(')}]'); mapping = dict(zip(opening,closing))...
1
vote
4answers
46 views

Python, how to print specific items from lists in lists?

I am trying to print the first and last item of all the lists inside my list of lists num_list. num_list = [[1,2,3],[10,20,30],[100,200,300]] for x in range(0,3): for y in range(0,1) and range(...
0
votes
2answers
32 views

Python - Replacing chars within list of strings

I am trying to remove the chars '0' from chars 2 to 3 of each item in the following list: list1 = ['0x001', '0x002', '0x0a3'] my desired output is: list1 = ['0x1', '0x2', '0xa3'] this is the way I ...
3
votes
3answers
68 views

Comparing and sorting two lists [on hold]

I have two following lists: indexList = [5,3,2,2,7,1] valueList = [1,2,3,4,5,6] I want to sort the two together, so that the output is: indexList = [1,2,2,3,5,7] valueList = [6,3,4,2,1,5] Then, I ...