list Questions
3
Solved
I need to generate all combinations of a matrix in Python. The input will be two integers n and m, and I need to generate all possible states of that matrix with 1 and 0 as possible values.
For ex...
Hildie asked 28/2, 2019 at 10:50
2
Basic Facts
Lists are mutable (supporting inserts, appending etc.), Tuples are not
Tuples are more memory efficient, and faster to iterate over
So it would seem their use-cases are clear. F...
Tana asked 8/7, 2024 at 2:16
2
Solved
I have a reprex as follows:
library(dplyr)
library(purrr)
df1 <- data.frame(
col1 = 1:5,
col2 = 6:10
)
df2 <- df1 %>%
mutate(col3 = 1:5)
ls <- list(
a = list(df1 = df1),
b = l...
3
Solved
I have a list of elements and I want to remove one of them, by value. In Python this would be
l = ["apples", "oranges", "melon"]
l.remove("melon")
print(l) # ["apples", "orange"]
What is the equ...
4
Consider the following piece of code:
def func1(a):
a[:] = [x**2 for x in a]
a = range(10)
print a #prints [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
func1(a[:5])
print a #also prints [0, 1, 2, 3, 4, 5, 6, ...
1
I have a list in a view (lets call it view A) where I push a view B via NavigationLink from view A and manipulate the CurrentSubjectValue to the initial view A. The moment the data is added and the...
Lightly asked 14/7, 2019 at 13:33
4
Solved
I am trying to create a simple multiple selection List with SwiftUI. I am unable to make it work.
List takes a second argument which is a SelectionManager, so I tried creating a concrete implemen...
5
Solved
I want to implement a custom list class in Python as a subclass of list. What is the minimal set of methods I need to override from the base list class in order to get full type compatibility for a...
7
Solved
Im trying to use Java 8 streams to combine lists.
How can I get a "symmetric difference list" (all object that only exist in one list) from two existing lists.
I know how to get an intersect list a...
Outfoot asked 26/6, 2015 at 13:30
6
Solved
I have a list of objects of class AA that contain a date and a list of objects of class BB:
data class AA(
val date: LocalDate,
val bb: List<BB>
)
@Parcelize
data class BB(
val x: Int,
...
Flapjack asked 5/8, 2019 at 10:38
6
Solved
I have created the following pandas dataframe:
import pandas as pd
import numpy as np
ds = {'col1':[1,"S",3,4,"S"], 'col2' : [6,"S",8,9,"S"],'col3' : [67,No...
2
Solved
in python, say I have a list [1,2,3,...,100], and I would like to use this list to create a dataframe which has one row and the row value is the list. What is the fastest and elegant way to do this...
4
Solved
I have a list of URLs in a .txt file that I would like to run using selenium.
Lets say that the file name is b.txt in it contains 2 urls (precisely formatted as below):
https://www.google.com/,ht...
Azeotrope asked 15/1, 2020 at 16:22
4
Solved
I have a list of string as List<String> temp = ['a', 'b', 'c', 'd'];
I want to modify and remove specific item from the list and return new list without the removed item.
For example, if I wa...
12
Solved
Why does list.index throw an exception, instead of using an arbitrary value (for example, -1)? What's the idea behind this?
To me it looks cleaner to deal with special values, rather than exceptio...
13
I'm writing an adapter framework where I need to convert a list of objects from one class to another. I can iterate through the source list to do this as in
Java: Best way of converting List<I...
8
I was following along with a react-beautiful-dnd tutorial that uses react component classes instead of hooks. I was writing an equivalent program with modern react syntax when I came across this er...
Army asked 31/5, 2021 at 21:18
3
Solved
Basically I am trying to do the opposite of How to generate a list from a pandas DataFrame with the column name and column values?
To borrow that example, I want to go from the form:
data = [
['Na...
Fraxinella asked 30/9, 2015 at 3:58
4
Solved
I have two columns. One column contains string values and another column contains decimal values. I want to select the decimal value by selecting the string value.
string decimal
Jewel 10
Hasan 20...
2
Solved
I am an R beginner and I am stuck on this problem. I had a dataframe and by using the split() function I have created a list of dataframes, e.g:
dfList <- split(mtcars, mtcars$cyl)
Now I want t...
1
I have created a custom navigation bar in SwiftUI, now I am trying to add a search bar and make the List searchable without system built NavigationView. I was wondering is there any possible way to...
5
Solved
I have a short question.
Lets assume we have a List which is an ArrayList called list. We want to check if the list is empty.
What is the difference (if there is any) between:
if (list == null) ...
5
Solved
I recently learned about List's .ConvertAll extension. I used it a couple times in code today at work to convert a large list of my objects to a list of some other object. It seems to work really w...
Hawks asked 3/5, 2014 at 0:59
6
Solved
Thanks for your responses. Yes, I was looking for the weighted average.
rate = [14.424, 14.421, 14.417, 14.413, 14.41]
amount = [3058.0, 8826.0, 56705.0, 30657.0, 12984.0]
I want the weighted ave...
Cataplasia asked 29/3, 2015 at 15:9
5
Solved
Why am I receiving this error when I run this code?
Traceback (most recent call last):
File "main.py", line 13, in <module>
def twoSum(self, nums: list[int], target: int) -> ...
Diocese asked 18/8, 2020 at 0:7
© 2022 - 2025 — McMap. All rights reserved.