Top "Flatten" questions

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.

How to make a flat list out of list of lists?

I wonder whether there is a shortcut to make a simple list out of list of lists in Python. I …

python list multidimensional-array flatten
Merge/flatten an array of arrays

I have a JavaScript array like: [["$6"], ["$12"], ["$25"], ["$25"], ["$18"], ["$22"], ["$10"]] How would I go about merging the separate inner arrays into one like: ["$6", "$12", "$25", ...]

javascript arrays flatten
How to Flatten a Multidimensional Array?

Is it possible, in PHP, to flatten a (bi/multi)dimensional array without using recursion or references? I'm only interested …

php arrays multidimensional-array flatten
Flatten an irregular list of lists

Yes, I know this subject has been covered before (here, here, here, here), but as far as I know, all …

python list optimization nested-lists flatten
Turn Pandas Multi-Index into column

I have a dataframe with 2 index levels: value Trial measurement 1 0 13 1 3 2 4 2 0 NaN 1 12 3 0 34 Which I want to turn into this: Trial measurement …

python pandas dataframe flatten multi-index
How to flatten only some dimensions of a numpy array

Is there a quick way to "sub-flatten" or flatten only some of the first dimensions in a numpy array? For …

python numpy flatten
What is the difference between flatten and ravel functions in numpy?

import numpy as np y = np.array(((1,2,3),(4,5,6),(7,8,9))) OUTPUT: print(y.flatten()) [1 2 3 4 5 6 7 8 9] print(y.ravel()) [1 2 3 4 5 6 7 8 9] Both function return the same list. …

python numpy multidimensional-array flatten numpy-ndarray
How to "flatten" or "index" 3D-array in 1D array?

I am trying to flatten 3D array into 1D array for "chunk" system in my game. It's a 3D-block game …

c# .net arrays 3d flatten
JavaScript flattening an array of arrays of objects

I have an array which contains several arrays, each containing several objects, similar to this. [[object1, object2],[object1],[object1,object2,…

javascript arrays loops flatten
Convert array of single-element arrays to one a dimensional array

I have this kind of an array: Array ( [0] => Array ( [0] => 88868 ) [1] => Array ( [0] => 88867 ) [2] => Array ( [0] => 88869 ) [3] => Array ( [0] => 88870 ) ) …

php arrays multidimensional-array flatten array-column