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
Automapper: flatten a nested collection
I have a problem mapping one of my DTOs which have a collection, to the flattened version in the entity model.
Here's the DTO classes:
public class Location {
public int LocationId {get; set;}
public string LocationName {get;set;}
public…

devC
- 1,384
- 5
- 32
- 56
-1
votes
1 answer
All permutations in adjacent elements of list
I do this:
from itertools import chain, combinations, permutations
import itertools
i = [5, 6, 7]
x = list(combinations(i, 2))
x.append((x[1][0],))
x = list(itertools.chain.from_iterable(x))
to take all the possible permutations but in a…

Outcast
- 4,967
- 5
- 44
- 99
-1
votes
2 answers
how to unify object's collections from stream of objects
I have this CasaDeBurrito class:
public class CasaDeBurritoImpl implements OOP.Provided.CasaDeBurrito {
private Integer id;
private String name;
private Integer dist;
private Set menu;
private Map…

Guy Sadoun
- 427
- 6
- 17
-1
votes
1 answer
Flatten regex group matches
Summary
I created a regex that will grab multiple different data from an html page. It uses grouped alternatives within a non-capture group. It works really well to grab the needed data; however, the groups are not combined in as few matches as…

Christopher Rucinski
- 4,737
- 2
- 27
- 58
-1
votes
1 answer
How to flatten RDD which contains sub list into main list
val rdd = df.rdd.map(
line => Row(
"BNK",
format.format(Calendar.getInstance().getTime()),
line(0),
scala.xml.XML.loadString("" +…

tree em
- 20,379
- 30
- 92
- 130
-1
votes
1 answer
how to flatten out a python list of mixed ints and strings
Im trying to flatten out the following list in python code. I keep running into an 'int is not iterable error' i know this is due to the list being both strings and ints. how do i account for this? sorry guys, first month of coding..... i know this…

mhsmustang1
- 113
- 1
- 1
- 4
-1
votes
1 answer
-1
votes
1 answer
How to map dynamic ViewModel List Type to DTO
Problem is to map dynamic list of nested objects to a flattened DTO. It includes flattening of nested object. Also, it is interface type.
Interface IfinalOutput
{
object MainOutput;
object CalcOutput;
object SupportOutput;
}
class…

Gaurav Gupta
- 173
- 3
- 15
-1
votes
2 answers
How to "flatten" images when printing from browser?
We have web pages that we want to allow the user to print. A page may include images that we wish to "protect". We employ several techniques to prevent a naive user from "copying" images off the web page.
When the user prints, one option the browser…

Eric Oemig
- 487
- 6
- 9
-1
votes
2 answers
how to flatten a nested array using recursion in javascript
I am trying to flatten a nested array contained in array variable. Everything looks fine in the code but still not working. Please help me what's wrong with my code. According to me this code should return a flatten array like [1,2,3,4].
var…

Gopendra
- 15
- 1
- 7
-1
votes
2 answers
Python - JSON to nested and flatten dictionary
I'm new in Python and currently trying to read the following JSON:
"level1_key1":"1",
"level1_key2":{
"level2_key1":"2",
"level2_key2":{
"level3_key1":"Max depth"
}
}
then put it in a dictionary (done by now) and finally show it…

Aktan A.
- 1
- 2
-1
votes
1 answer
Flatten xml hierarchy using XSLT
I would like to convert a nested xml to flatten xml using XSLT.
Incoming xml Structure would be similar but the node names would change for the incoming xmls, so would like to handle in dynamically
Sample input

saravana perumal Raj
- 35
- 3
-1
votes
2 answers
Flattening of list in scala
I have jumped into Scala and started doing scala99, but I am stuck at P07 (flattening of list) following is my code and error message from the repl
scala> def flatten[A](x: List[A]): List[A] =
| for(i <- x) yield i match {
| case lst: List[Any] =>…

Anmol Gautam
- 949
- 1
- 12
- 27
-1
votes
1 answer
Variable leveled multi-dimensionaled array to value 'flattend' array with PHP?
I'm looking for a solution to flatten a variable multi-dimensionaled array to flatten all the values in the last available array to a single Array[] (containing the dataset of each last array in the multidimensional array).
Any help is…

daan.desmedt
- 3,752
- 1
- 19
- 33
-1
votes
2 answers
Edit nested list in python 3
How do I unnest a nested list or flatten a nested list.
so that,
servers = [["10.10.10.10" , "20.20.20.20"] ,["30.30.30.30"] , ["40.40.40.40", "50.50.50.50"] , ["60.60.60.60"],["70.70.70.70"]]
becomes,
servers = ["10.10.10.10" , "20.20.20.20"]…

degixer
- 39
- 10