3,242 questions
0
votes
0
answers
43
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 ...
3
votes
1
answer
104
views
How do I make a Prolog rule that only reads the lists inside lists?
I am somewhat new to Prolog, having only practised for a few months so far. I am stumped on the following problem and nothing I googled seemed to help.
I wrote the following code into a Prolog ...
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
votes
1
answer
126
views
How to iterate through a list of lists and access each element in the sublist and store for use in functions?
I'm working in Python and I'm trying to generate coordinates for circles with their radii being appended after coordinate generation. Once I have the list I want to check it against itself to see if ...
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:...
1
vote
1
answer
36
views
Ansible: save item from nested list based on match from a separate list
I'm new to ansible so i'll try to explain this as best as I can...
I have two lists created from separate json_query results. One of them contains nested lists with two related items each (vm and ...
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"),...
-4
votes
2
answers
79
views
find the min of int value mixed with string value in a nested list in Python [closed]
I have a nested li below, I wanted to return a nested li with the string with and min of the int value within the same string value. Any idea?
li=[['a', 10], ['a', 20], ['a', 20], ['a', 40], ['a', 50],...
-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
91
views
Error handling for tidyr hoist in API call dplyr pipe when column type changes between calls
I'm working with the Jira Native API to bring in dashboard data to R for rectangularizing.
The max results that can be returned each call is 100. I'm working with a small dashboard atm but am thinking ...
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 ...
0
votes
0
answers
20
views
Making nested lists Vs making nested sets (without frozensets)
If I wanted to make a nested set:
nested_set = {{1, 2, 3}, {6, 4, 5}, {12, 8, 5, 7}}
It would give the error: TypeError: unhashable type: 'set'
However if I wanted to make a nested list:
nested_list =...
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" ...
-2
votes
1
answer
35
views
Adding lists to a list
I have a value that creates a list with two values. I need to add it as a sublist to another list muptiple times.
I need the resulting list to look like this:
[["a", 1], ["b", 2], [...
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,...
3
votes
1
answer
410
views
Space and time complexity of flattening a nested list of arbitrary depth
Given a python list that contains nested lists of arbitrary levels of nesting, the goal is to return a completely flattened list i.e for the sample input [1, [2], [[[3]]], 1], the output should be [1, ...
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-...
0
votes
1
answer
93
views
C# How to Group List for XML Object
I need help, for group by my XML object class.
Here my data from SQL server, my Query
( select * from TaxXMLdb ) =
TIN
DocEntryAR
BuyerDocNum
BuyerName
Opt
ItemCode
Name
DocEntryAR2
AAA
100100
5533
...
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 ...
-1
votes
2
answers
48
views
How do i print nested list with new row on each nested list within the main list
Currently coding a python sudoku game and I've got a nested list acting as my board, however the list when printed prints out all in one single line, how do I get each seperate list within the nested ...
0
votes
1
answer
104
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 ...
0
votes
2
answers
86
views
Difference between `for item in list` and `for i in range(len(list))` when updating items in nested list
My understanding is that if I want to update the items of a list in place, this works,
l = [1, 2, 3]
for i in range(len(l)):
l[i] += 1
and this doesn't,
l = [1, 2, 3]
for num in l:
num += 1
...
-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
1
answer
41
views
Why does using df.iloc[[i][0]] in Pandas' iloc() lead to specific behavior?
I am just starting to learn Pandas, and in a piece of code, there is a call to df.iloc[[1][0]] (where df is a pd.DataFrame with a shape of (60935, 54)). From the context of the code, df.iloc[[1][0]] ...
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 ...
2
votes
2
answers
116
views
Combining lists of lists of dataframes
I have a list of lists of dataframes, where each dataframe has a name according to its position in its list. I want to rbind my dataframes together according to their name.
A1 <- data.frame(cars*...
3
votes
3
answers
221
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 ...
3
votes
2
answers
119
views
Using a Recursive Function to Create a List Nested n Times
I have the following data frame.
Data_Frame <- data.frame(Factor_1 = rep(LETTERS[1:4], each = 12, length.out = 48), Factor_2 = rep(letters[1:3], each = 4, length.out = 48), Factor_3 = rep(1:2, each ...
0
votes
0
answers
51
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 ...
-1
votes
2
answers
104
views
How to sort two nested list which are linked by indexes
I am trying to sort a nested list by date (which I can). Then if the list has duplicate dates, sort the duplicate dates by time.
The first part of the list is the date or time, second part is the ...
-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
votes
3
answers
65
views
Creating nested lists from a single list
Suppose I have a list like this:
my_list = ['a_norm', 'a_std', 'a_min', 'a_max', 'a_flag', 'b_norm', 'b_std', 'b_min', 'b_max', 'b_flag', 'c_norm', 'c_std', 'c_min', 'c_max', 'c_flag']
I want to ...
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": {...
-1
votes
2
answers
50
views
Take a Python dictionary with values as lists and create a new list of dictionaries each with the initial key and list values
If I have a dictionary with list values:
users = {'first-name': ['Jim', 'John', 'Jane'], 'last-name': ['Boothe', 'Smith', 'Doe'], 'user': ['100', '101', '102']}
How can I create a new list of ...
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 ...
3
votes
2
answers
79
views
Nested partitions of integers
I want to create all nested partitions of an integer - with all possible permutations of numbers and brackets (nests) at all possible positions.
For example, for n = 3, I would like to have
(3,)
(1, 2)...
-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....
0
votes
2
answers
57
views
Check for text in nested lists in R [closed]
I have a nested dataframe where one of the columns (Reviews) is a list containing lists (text, rating, date) as shown below in text format.
structure(list(Name = c("Afsondering Clinic", &...
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
0
answers
37
views
Iterate to a nested list in a pythonic way [duplicate]
I have the following payload:
payload = [{
"identification": {
"corporationName": "Test",
"code": 1234
},
"locations": [
{
&...
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 ...
1
vote
3
answers
128
views
Searching a list in F# with multiple fields
I have a mixed list in F# that looks like the following:
let list1 = [("a1",[1;2;3;8]);("a2",[2;8;6;10]);("s3",[4;8;5;12])]
Is there a way to retrieve [1;2;3;8] if pass ...
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
2
answers
26
views
Preserving exact path to object that matches query string
I have modal in a React app that renders a list of items with a list of nested values and a search bar. When the user types into the search bar, I need to be able to match that input to an item in the ...
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),
...
2
votes
1
answer
61
views
get group of sublists that share common elements but those elements are not the same in all sublists
I have to group sub-lists with a common element in set "p", using python. p elements are not always in 1st or las position on the sub-list. Grouped (result) lists is list r.
Result list r is ...
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
...
0
votes
1
answer
436
views
How should I sort the elements of the Hackerrank practice challenge nested list and then output the second lowest score the right way?
I tried sorting this challenge in so many ways but this time apparently my script is sorting the wrong way this time.
The challenge consists in you inputing the students name and score then the script ...
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 ...
1
vote
1
answer
3k
views
How to nest numbered list to numbered header in markdown?
I'm trying this one according to documentation "nested starts at first char", but that doesn't work, falls into quotation mode idk why btw.
## 1. Section 1
1. Step 1.1
2. Step 1....