Category "list"

Mean calculation between dataframes in list in R

I have a list of dataframes that all have the same format (same number of rows, same number of columns and columns have the same name). I would like to create a

Prolog: replace the nth item in the list with the first

I'd like to have a Prolog predicate that can replace the nth item in the list with the first. Example: % replace(+List,+Counter,-New List, %-First Item). ?- rep

Comparing lists with order

I wish to compare lists and output the similar matches that following each other in the same order. list1 = ['a','b', 'b', 'c'] list2 = ['b', 'a', 'a', 'c'] #

How can I implement Tail Recursion on list in Haskell to generate sublists?

I want to make the biggersort function recall itself recursively on the tail of the list. My code below works and gives me the following output : [6,7,8] I wan

Is it worth adding zeros to rows of uneven number of columns in a list of lists?

I have a working Haskell example of how to do it when we want to add zeros to the left and to the right of a list as two separate functions, and I did it becaus

Python: Compare values of two fields with multiple strings and add all unique values to a 3rd field

I am still a Python-Rookie and are stuck with an idea. I want to compare the values of Type1 with Type2 and add all unique values to a 3rd field. My demo data:

Converting PYODBC output into an int

Pulling data from a SQL query that gives me 1 number that is stored in a PYODBC row. I want to then add that number to another variable in the file. Pseudocode

How to create a dictionary, where the key is the key of a dictionary of lists and the value is the longest list

I have this dictionary of lists of dictionaries: dict_countries ={'uk': [{'datetime': '1955-10-10 17:00:00', 'city': 'chester'},{'datetime': '1956-09-10 13:00:0

How to find different items between mulitiple lists

I am trying to figure out how to compare n lists to find the different items. For example, consider the list: list_l = [[1,2,3,4,5,100], [1,2,31,41,

C#: Update List Item

public class person { public string name { get; set; } public string family { get; set; } } And I have a list of the same as Below: List<person&

Python valueError: setting an array element with a sequence, TypeError: only size-1 arrays can be converted to Python scalars on MLP

I have this dataset (shape is (36,2)). x is a numerical pattern, y is a binary class (0,1) x y [0.2, 0.3, 0.5 ..... 0.5] 0 [0.1, 0.4, 0.5 ..... 0.9] 1 and so

Add item to SharePoint list

How do I add an item from an Excel file to a SharePoint list? I cannot use Access as an additional step here. Within Excel 2019 I run a macro and part of it sho

How to get forwaard moving combination of a list in python?

I have a following list lst = [100,200,300,400] I need the following output [(100, 200), (200, 300), (300, 400)] I did some research and used itertools.combinat

SwiftUI - List Line Separator Inset like iOS Settings App

I'm trying to achieve the behavior that's also seen in in the iOS Settings App or for instance the Roborock App (see screenshots below). I'd like to go for an I

How to validate list of email in winform C# with specific rules

Mine concern is the following. I have these 2 classes : public class Campaign { public string name { get; set; } public string description {

How to return a position of elements in a list using only positive number?

I created a list for the user to enter a number, which is the position of the elements in the list, but it still work for negative number. Are there anyway to s

function that takes directory of .txt file and returns a dictionary based on set parameters?

I want to make a function that takes the directory of a .txt file as an input and returns a dictionary based on specific parameters. If the .txt file is empty,

How to print strings and integers in the same line?

I'm trying to print each item in the following two lists: lNames = ['John','David','Michael'] lAges = [45,14,32] with the format: "Person 0, Name: John, Age 3

How to loop vertically through a list in Python?

This is my code atm: puzzle = [ ['1','1','1','1','1','1','1','1','1','1'], ['1','0','0','0','0','1','1','1','1','1'], ['1','1','0','1','0','0','0','0','0','0'],

How to insert an element in a list after using del in python

def my_len(lst): mylen = 0 for i in lst: mylen += 1 return mylen def insrt(lst, what, where): length = my_len(lst) tmp = [0] * (len