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
9 views

How to keep the names of the data frame variables while unlisting? [duplicate]

I try to unlist a list that contains multiple data frames while keeping the variable names. The list items (the data frames) don't have names but the variables inside the data frames do. For example:...
-2
votes
2answers
32 views

Searching value in list of list then appending to empty list

I have come across this: finalList = [] dateTime ="SCHEDULE: " + str(datetime.datetime.now().strftime("%H%M")) + "H" for sublist in main_List: if dateTime in sublist[0]: finalList....
1
vote
1answer
27 views

A function that it takes corresponding elements from the second list based on the first lists of indexes

I need help with this assigned problem for my programming class. You need to implement a function subList such that it takes corresponding elements from the second list based on the first lists of ...
-3
votes
0answers
31 views

Using Arrays.asList together with ArrayList missing last element [on hold]

I'm trying to convert an array of Integer to List of Integers. However, when I do it with this code. I am missing the last element, in this case '5'. Integer[] bufferIntArr = {1,2,3,4,5}; List<...
-1
votes
5answers
51 views

Using list comprehension to remove undesired rows and columns and convert all string items into integer type

I have a data-set of student's marks in a CSV format as follows: data = '''student,maths,science,english,nepali,computer John,57,77,73,50,55 Mark,52,66,89,78,50 Ben,57,85,53,87,53 Toby,90,63,64,76,58 ...
1
vote
1answer
16 views

Is there a way to sum only the integers in a list of pairs that contain a letter and an integer in Prolog?

I'm having trouble figuring out how to find the sum of the integers that are in a list of pairs like so: [[a, 1], [b, 2], [c, 3], [d, 4]] I tried something like this, since it is reminiscent of a ...
-1
votes
1answer
32 views

Formatting Dates from Array in Python

I am trying to convert the date format in an array from '2018-03-02' (Y-m-d) to '20180302'. I would think a for loop through the dates array would change each date, however, I am getting the following ...
1
vote
2answers
34 views

Extracting values from a list of dicts based another value in python3

I have a lists of dictionaries: list = [ {'i': 1, 'j': 1, 'diff': 39}, {'i': 1, 'j': 1, 'diff': 27}, {'i': 1, 'j': 1, 'diff': 18}, {'i': 1, 'j': 1, 'diff': 33}, ... ] From this, ...
2
votes
2answers
35 views

Extract the same item from each list within a list within another list

I have a list (modified from this example subsetting lists) that looks like l3 <- list(item1 = list(item1a = data.frame(matrix(1:9,ncol = 3)), item1b=letters[1:5], ...
0
votes
0answers
13 views

When using recursion, how can I append or concatenate multiple pairs into a single, longer list?

This is a homework problem, so please point in a good direction w/o giving a solution. Basically, within Scheme, I am trying to build a multi-bit adder starting with logic gates. Thanks for reading/...
0
votes
1answer
28 views

Distances in a list of lists

So my problem is the following: I have this list of altitudes in a mountain -- test -- and I want to make a function that can return the coordinates (row, column) of the altitude that is to be reached ...
0
votes
0answers
15 views

list of dataframes in R: assignment problem

I have the following code: child_tracks <- list() for(i in 1:106) { for(j in 1:5) { child_tracks[[i]][[j]] <- all_samples[[i]][sample(nrow(all_samples[[i]]),...
1
vote
3answers
45 views

Replace occurence in a String in Kotlin

I have two list of Strings. Now I want to replace every occurence of a word in the first list at index i with a word in the second list at index i of a sentence. So if I have list a=("am","I","my")...
0
votes
2answers
31 views

Split String Into Array Elements Based On Punctuation In String - JavaScript

I want to split a string into separate array elements by sentence. So a split needs to occur after every period. I.e. this: Love is a burning thing and it makes a fiery ring. Bound by wild desire, I ...
2
votes
0answers
53 views

ConcurrentModificationException When removing element using list iterator java

I have an issue removing the 1st and 2nd element of my list even by using the iterator. I have read the following threads but can't fix my issue (those were the most relevant but I checked other ...
-1
votes
0answers
51 views

List empty when accessing from another class

As my program starts it obtains information, converts them to an object and then adds that object to a list. Using Console.WriteLine when adding each object to the list I can see that the list is ...
-1
votes
2answers
37 views

What am i doing wrong while running this code?

First off, I am in no way a programming expert, and am not well versed with python, so forgive me if this is a stupid question. I am trying to run the code below to filter a fasta file down to only ...
-1
votes
2answers
37 views

Cannot implicitly convert type 'string' to 'XXX.ClassName'

I have created a class named Student and I have the following code inside Program.cs: public static IList<Student> Students { get; private set; } private static void AddStudent() { ...
1
vote
1answer
20 views

How to take user input and put it in a new array within an array in python?

I'm trying to put user input (just a list of ints) into a list that already exists with one element in it. I'm not sure if it's possible to have a list running off of one element in an already ...
0
votes
0answers
20 views

R: change specific elements from data frame to colnames and switch rows to columns

Let's have a list of data tables: df1 <- data.frame(V1=c("a", "b", "c"),V2=c("d", "e","f"), V3=c("g","h","i"),V4=c("j","k","l")) df2 <- data.frame(V1=c("m","n"), V2=c("o","p"), V3=c("q","r")) l ...
-2
votes
2answers
37 views

What does ',' do in this slicing operation - [:,::-1] [duplicate]

While going through Sklearn Tutorial I came accross this piece of code order_centroids = original_space_centroids.argsort()[:, ::-1] I do not understand what :, does. The data stored in ...
0
votes
0answers
11 views

How to subset comparisons of list tuples in a combination loop

I have a .txt file that contains 100 rows and 500 columns. Each row has a single integer value for each column. (ie. 1 0 1 2 0 2 1 0...). For each row, I want to compare each column to every other ...
-1
votes
0answers
10 views

how to change tag select -> option border radius ? (items rounded)

I changed select style with border radius but select -> option don't change style and don't work border radius Please see the attached file to understand the problem better problem image :
0
votes
0answers
16 views

When trying to join matrices the attempt leads to an out of bounds error. (r)

I am trying to join matrices together. My goal is really as simple as to take multiple matrices from one list, marry them, and put them in a new list. To ensure clarity, let me preface this with a ...
0
votes
1answer
31 views

Slack events: IndexError: list index out of range

I am trying to read events from slack and return the response for the matching event. The problem is, when I match an event and return it to slack, it gives me an error: IndexError: list index out ...
0
votes
0answers
28 views

Create specified list of dictionaries with list comprehensions

I have list of dictionaries: test_users = [{'user': 'ADMIN0', 'privilege': 'ADMIN', 'auth_protocol': 'SHA_512'}, {'user': 'ADMIN1', 'privilege': 'ADMIN', 'auth_protocol': 'SHA_256'}, \ ...
-1
votes
0answers
30 views

How to output Unicode characters in a text box in C#?

I'm trying to output Unicode characters to a text box in C#. I'm using a function which returns a list of chars containing Unicode characters which I want to output to a text box in sequence. If I ...
0
votes
2answers
29 views

Is there a way to automate extraction of elements from two or more lists?

My goal is to automate fetching of trends data along with the extraction of "interest_over_time" from the lists. Considering it a two-step problem: Automating fetching of data based on a group of ...
0
votes
1answer
38 views

How to use cbind on matrices in one list and place them in another (r)

I'm trying to join matrices stored in nested lists and place them in a new list. For example, if I have a list of fruit, I would like to take various matrices stored under Kiwi, and join them together ...
1
vote
3answers
28 views

How can i find max element index for a specific value in list composed of class objects?

I want to find a maximum elements index in a nested list for each row. I got this error: maxe = array[i].index(max(e_object.x for e_object in array[i])) ValueError: 5 is not in list class ...
-1
votes
1answer
18 views

How to fix 'IndexError: list index out of range' in python?

I am in year 10 and really bad at coding. Basically I am trying to make a really simple evolution simulator and it has been working well so far but I ran into this error when using lists to define ...
0
votes
0answers
10 views

Python List unpacks bytes automatically

Python 3.7.3, struct bytes packed and called in list which unpacks and shown numeric numbers, I unable to figure it out, what it is? how to use this numbers?, if same put inside of [], nothing changes....
-4
votes
1answer
29 views

Can someone please explain this Python code? [duplicate]

Whilst I know what this piece of code does i have no clue how it achieves it. Can someone please explain it in the dumbest way? vec = [[1,2,3], [4,5,6], [7,8,9]] [num for elem in vec for num in elem] ...
1
vote
1answer
33 views

List in Salesforce

I am getting an error message when I am executing the below code saying that variable myList is not found. public class ListExample { List<Integer> myList=new List<Integer>{1, 2, 3, 4,...
-1
votes
0answers
6 views

How to convert checkbox list to bits in byte?

I need convert checkbox list of 8 components into single byte, how do it simple?
-4
votes
0answers
25 views

how can I modify the list object?(insert and remove) [duplicate]

days2 = ['Mon', 'Tues', 'Wed', 'Thur', 'Fri', ['Sat', 'Sun']] into days2 [['Mon', 'Tues', 'Wed', 'Thur', 'Fri'], 'Sat', 'Sun']
0
votes
0answers
20 views

Allow modification of list during loop [duplicate]

In most cases, the user is modifying the array directly within the original loop. In my case, the array is being modified by a method being called inside of the loop, outside of the loop's control. I ...
0
votes
1answer
46 views

Remove characters from a string in all elements of a list

Im trying to replace all strings which contain a substring by itself, in a list. I've tried it by using the map function: cleanUpChars = map(\w -> if isInfixOf "**" w then map(\c -> if c =="*"...
-3
votes
2answers
43 views

Need to convert List<E> to an Element

I am passing in two lists of element E and want to insert one of the lists into the other at a specified index. I get the error "List cannot be converted to E" and I am unsure how to convert the ...
0
votes
3answers
51 views

Calculate the differences of list elements using zipWith

I have to make a function called differences, where I calculate the difference of every pair with zipWith and put it in a list. For example differences [1..5] == [1, 1, 1, 1]. So [2-1, 3-2, 4-3, 5-4]...
0
votes
1answer
96 views

Trying to figure out how to return the mean value of each column in a data frame using a list

I have a data frame which shows the average life expectancy of a country from 1800 to 2018.The Columns are labeled like this: XYear. For example: X2000. I made a function which returns the mean value ...
0
votes
2answers
22 views

I have defined a function with two outputs and returns a list. how can I call for one of the outputs in the minimize function?

how can I call for one veriable returned by a function out of multiple outputs to use it in other function solution = minimize(objective,...) I defined objective two return a list of two variables ...
-6
votes
2answers
29 views

Unable to use convert strings into integers for a for loop

I am trying to create a golf calculator in which I enter two strings (par_string,score_string). For each item in par_string and score_string, I subtract the score_string item from the par_string item. ...
1
vote
3answers
47 views

Can't Go Past First Dict In JSON File

I'm trying to iterate through a JSON file to search for specific parts and print out that portion of the file. But my code only works for the first dict in the file, anything past that will have my ...
0
votes
2answers
20 views

Why can't my index code find the item in the list?

index function error with a list created using a for loop and append methods. I'm a novice so I could not understand the problem. from random import shuffle class Cards: suits = [ 'Spades' , '...
-1
votes
0answers
15 views

twice output for the same i value in a for-loop?

I´m just practicing with a for loop and I don´t know why I get back a 0 twice when I have only one in the list : def testing(self): nega = [] pos = [] loops = 0 for i in self: ...
2
votes
2answers
30 views

List integers to string using classes

I want to write a class for vectors, and I need to be able to cast the integers in the list to a string and print them. Example: [1,2.5] --> "<1,2.5>" This is what I came up but its not working, ...
0
votes
0answers
6 views

Separate input into list

I ask for a number input. Say the number is 3. Then I want to ask for the number (3) more inputs and separate them into a list. Example: 3 12:00 12:30 11:40 13:30 13:15 13:45 I want the list a to ...
-1
votes
2answers
38 views

Is there a method to perform this function recursively?

I'm still relatively new to Python. Is there a way that I can perform this function recursively? I'm looking for matching pairs and excluding non-matching pairs with '+'. integ = 3 #number of ...
1
vote
2answers
70 views

How to extract last date from string within panda dataframe

I need to find the last date preceding specific text within a string for each row in a panda dataframe. The text could be anywhere after the date within the string. I have a csv file that consists of ...

http://mssss.yulina-kosm.ru