1 A list of lists
2 Using list comprehension
3 A list of varying depth (deep flattening)
4 Using recursion
5 Flatten without recursion
6 Flatten nested lists
7 A list of tuples
8 Flatten 2d array
9 A list of NumPy arrays
9.1 numpy.ravel()
9.2 numpy.flatten()
9.3 numpy.reshape(-1)
10 Flatten JSON objects
11 Flatten a list of objects
12 Flatten a list of DataFrames
13 Flatten & remove duplicates
14 Flatten a dictionary into a list
15 Using reduce
https://likegeeks.com/python-flattening-lists/
Hope you like it.
Regards,
Top comments (0)