3,242 questions
0
votes
0
answers
52
views
How do I properly insert 3 into my nested list tree?
I am working on a program that is supposed to build a tree using nested lists in Racket. I believe I am very close, but I am stuck on one section of my insertion testing process.
The syntax for my ...
2
votes
1
answer
66
views
Strange behavior when partitioning list of tuples into different lists [duplicate]
I found some really unexpected behavior today using python 3.12.4. I am trying to sort a list of tuples into 2 different lists in a list of lists based on the first number of the tuple. Instead, each ...
1
vote
1
answer
86
views
Trying to create nested lists of text data based on test group and questionnaire response, then return the total number of each type of response
My macro accurately creates 2 lists of numerical data based on which group (control or exposed) a subject is in.
Dim Subjects As Integer
Subjects = Sheets("Participant Info").Range("C4:...
2
votes
1
answer
112
views
Data frame into nested list (tree)
How to turn a data frame into a recursive list of lists (tree)?
Input
roles_data <- data.frame(
Child = c("A", "B", "C", "D", "E", "F"),...
-1
votes
3
answers
151
views
Trying to delete overlapping nested lists in Python [closed]
I'm trying to write a code in python that can remove overlapping lists. My lists are in the format [lower_bound,upper_bound,data,data]. These lists are stored in a larger list. I want to iterate over ...
1
vote
1
answer
54
views
drag-and-drop functionality works on a basic level but fails when dealing with deeply nested elements
I'm working on a dynamic nested tree structure using Angular CDK Drag & Drop. The drag-and-drop feature works at the first level but fails when trying to drop elements deeper in the hierarchy. The ...
1
vote
3
answers
86
views
How to check for specific structure in nested list python
Suppose we have the list:
mylist = [
[
"Hello",
[
"Hi"
]
]
]
How do I check that list containing "Hello" and "Hi" ...
0
votes
2
answers
117
views
Efficient connected components from a 2D array
In an m x n matrix consisting of 0s and 1s, we are tasked with counting the 4-directionally connected islands of 1s. A python implementation is as follows:
def numIslands(grid):
def sink(i,...
0
votes
3
answers
1k
views
How can I specifically "exclude" an element from a css grid/subgrid or position it correctly in a complex entanglement of nested grids…
* {
outline: 1px solid rgba(255, 0, 0, .2);
}
ol {
*:not(li) {
grid-area: none;
/* hmmm... this is not right*/
}
padding: 0;
list-style: none;
display: grid;
grid-template-...
1
vote
1
answer
124
views
Any way to check if a number is already within a 3x3 grid in a 9x9 grid of nested lists?
Programming a sudoku game and I've got a nested list acting as my board and the logic written out however I am stumped on how to check if a number is specifically within a 3x3 grid within the 9x9 ...
0
votes
1
answer
105
views
Recursive nested ul ordered by depth
I am creating a nested list from an array generated from an hierarchical table of categories, with subcategories having a parent ID of the parent category ID. I am trying to display the list in a ...
-1
votes
2
answers
176
views
What is a faster way to deep copy a nested list without using .deepcopy()?
I have two variables with the following structures:
# initialization
O1 = [[] for g in range(n)]
for i in range(n):
O1[i] = [[] for g in range(m)]
O2 = [[] for g in ...
0
votes
0
answers
47
views
Problem with recursion interfering with a for loop iterating over a nested array in JavaScript
I have a function in my JavaScript code which iterates over an array called background_check which has elements which are also arrays. I want to see if any element in this nested array is a 0 (each ...
3
votes
3
answers
223
views
Create a nested list from a dataframe using multiple columns
I have a dataframe that I would like to convert to a nested list, by row. However, I need to group several columns into separate matrices in each nested element. All of the solutions I've seen put ...
0
votes
0
answers
52
views
Query regarding the rendering of $math$ in nested lists in CoLab
I am using CoLab to prepare some teaching materials. This is great because students do not have to have python (etc.) installed on their machines. (Thanks to google!)
I want to embed some math code in ...
-2
votes
1
answer
93
views
How can I write more efficient for loops in python
I want to print the first letter of each string in a list on one line, and then the next letter on the next line, etc. When a string runs out of letters, it prints a space instead. Also this is my ...
1
vote
1
answer
120
views
Counting number of nested levels in JSON object in T-SQL returns not properly formatted error message
The following script, in SSMS 19.3, throws this error:
JSON text is not properly formatted. Unexpected character '.' is found at position 1.
DECLARE @json NVARCHAR(MAX) = '{
"level1": {...
0
votes
1
answer
59
views
How to store nested lists in Postgres?
How can I store nested lists in Postgres in way that's easy to use them in my Python program later?
I plan to write the lists to the database once and reuse them many times. I've been able to store ...
-1
votes
1
answer
43
views
how to convert nested lists to data frame when the lists contain multiple items like anova, post-hoc etc
I performed the split.plot analysis using doebioresearch package in R. The result for multiple traits is generated in form of nested lists and the overall structure of the output file is multi-layered....
1
vote
2
answers
77
views
I am grouping integers into a nested list. But I end up with with two sublists each time instead of multiple
Given an integer list and a key, I am required to group the list by greater than or equal to the key, or less than the key.
For example, When
key = 6 and lst = [1, 1, 1, 0, 0, 6, 10, 5, 10]
Output ...
0
votes
2
answers
55
views
How can I reduce line height in nested lists? [duplicate]
I wanted to make the line tighter in an ordered list.
So I just style it - and it is fine.
|This style has always worked well for me.
Until I add a nested list, and it is not working well.
For some ...
4
votes
3
answers
191
views
Why is `tranpose [[]] == []` in Haskell?
Consider the following?
ghci> transpose []
[]
ghci> transpose [[]]
[]
ghci> transpose [[[]]]
[[[]]]
ghci> transpose [[[[]]]]
[[[[]]]]
ghci> transpose [[[[[]]]]]
[[[[[]]]]]
ghci> ...
0
votes
1
answer
45
views
r nested lapply with two opposite conditions
I have a dataset which is like this.
library(dplyr)
set.seed(505)
tempdf1 <-
data.frame(
y = rnorm(400),
x1 = rnorm(400),
x2 = rnorm(400),
x3 = sample(1:5, 40, replace = TRUE),
...
3
votes
2
answers
108
views
Tidyverse/Dplyr solution to assigning values to column names extracted from a nested list
I have a tibble with a column containing a nested list (<list<list<double>>> data type to be specific).
It looks something like the following (but in R/Arrow format):
ID
nestedvals
...
2
votes
2
answers
87
views
Intelligently extract linear model coefficients from a nested list
I'm an R veteran who usually hates working with nested lists because of how tricky they seem get... but I am not sure I can avoid them here. In this case, I can make the output that I want, but I'm ...