Flattening refers to either reducing a multi-dimensional array to a single dimension or to reducing a class and class methods to handle based function calls.
Questions tagged [flatten]
1554 questions
-1
votes
1 answer
Google sheets get empty cells next to each other
Link: https://docs.google.com/spreadsheets/d/1hCG6jjGSGWMn5kBkDfcoTJkZ2eCC5SRvHWMFTBp_6OE/edit?usp=sharing
I want to return "Yes" or "No" results in column N when there are empty cells next to each other in the range B:M
And column O counts the…

user12285292
- 29
- 4
-1
votes
2 answers
Convert array values on second level of 3d array to simple strings
This is my input:
[
["username" => "erick", "location" => ["singapore"], "province" => ["jatim"]],
["username" => "thomas", "location" => ["ukraina"], "province" => ["anonymouse"]]
]
How can I flatten the inner arrays to string values?
Expected…

Tech
- 35
- 6
-1
votes
3 answers
how to convert nested for loops into list comprehension in python
I was working on flattening this multidimensional list
f_list =[[[1, 2, 3]], [[4, 5, 6]],
[[7, 8, 9]]]
and i did using nested for loops like so
new_l=[]
for sublist in f_list:
for subsublist in sublist:
for i in subsublist:
…

devuser
- 7
- 4
-1
votes
1 answer
How to check JSON and add/remove key
I have a JSON file as an export of a nosql database, the sample below is 2 of 1xxx records.
{
"task": {
"id1": {
"completed": true,
"title": "Testing",
"desc": "short desc",
"status":…

Vincent Tan
- 1
- 2
-1
votes
4 answers
How to flatten the nested array of of objects and duplicate the parent
I have an array of objects that has one of the properties("attributes") as array of objects.
var products = [
{
"productId": "1",
"attributes": [
{
"variant":"red",
"price": "134.00"
…

texpert
- 185
- 1
- 3
- 14
-1
votes
1 answer
Flattened Int array C++ (the ends of each integer is translated wrongly)
There is an array of integers, and I want to turn them into an array of separated digits and print them back out as the same sets of integers.
ps: reason being, I want to do lots of individual digit calculations, and I want to use this method to…

Tommy Lau
- 25
- 6
-1
votes
3 answers
Python: nested list of lists with elements grouped by 3
From an initial list:
starting_list = [
[1,2,3, 4,5,6, 7,8,9 ],
[11,22,33, 44,55,66, 77,88,99 ],
[111,222,333, 444,555,666, 777,888,999]
]
I would like to create a new list (either using a for loop or list…

ZwiTrader
- 195
- 1
- 2
- 12
-1
votes
3 answers
Determine Size Of Array of Equal Items Excel
I have an array that looks like this
11100100110
essentially, an array of fixed size with each item being a 1 or 0 with the last item always equal to 0.
Consider each set of consecutive 1's to be a "bucket". I'd like a formula to determine the size…

cershif
- 154
- 1
- 13
-1
votes
1 answer
jq flatten a deeply nested json document
Considering the following deeply nested json object
[
{
"level1key": "level1value",
"children": [
{
"level2key": "level2value1",
"children": [
{
…

AmazonFreeBanana
- 1
- 1
-1
votes
1 answer
Need a way to dynamically sum multiple columns into a Merged cell of varying heights
In this scenario, I am looking to total Columns G through M by 'user' in Column E. Column N does have the correct data, but it is using the formula =sum(f4:m5). I am looking for a way to add an array formula because the heights of the merged…

Gateway Intelligence
- 29
- 4
-1
votes
1 answer
Python: Flatten multiple nested dict and append
I Hello all,
I am looking for help in trying to flatten multiple nested dicts and append them to a new list.
I have multiple dicts, loaded from a geojson-File like that:
data = json.load(open("xy.geojson"))
They are all structured like…

bvboisseree
- 3
- 3
-1
votes
1 answer
Flattening lists in Prolog
How can I flatten a list in Prolog, for example:
from A = [["a","b"],["c"]]
to B = ["a", "b", "c"] ?

Lucian Green
- 182
- 6
-1
votes
1 answer
How to flatten a table into one single row?
Is it possible to convert the table from the left to the table on the right with PowerQuery?
Dont´t mind the labels except Table1, because they already exist in the destination.
In real life Table1 would be an Excel sheet and I have to flatten many…

Nicolás Lope de Barrios
- 143
- 1
- 9
-1
votes
1 answer
Fill a cells value based sequence every new row in Google Sheets
Is it possible that each time a new row is added, the value of a cell is automatically filled based on a sequence that repeats indefinitely?
What I need to do is fill in the Sales Rep name in a column (there are only 6 sales reps in the list) every…

fvdev
- 35
- 8
-1
votes
1 answer
Forming a Line of Row of Date from just Two Cells Information Google Sheet
I have list of assets
There is information about buy date and buy value
there is information about depreciation year
I want to make the year of each deprecation and the depreciation value, be described yearly from top to down automatically
I prefer…

Randy Adikara
- 357
- 3
- 10