<jupyter_start><jupyter_text>---title: "Flatten Lists Of Lists"author: "<NAME>"date: 2017-12-20T11:53:49-07:00description: "Flatten lists of lists using Python."type: technical_notedraft: false---<jupyter_code># Create a list containing three lists of names
list_of_lists = [['Amy','Betty','Cathryn','Dana'], 
                 ['Elizabeth','Fay','Gora'], 
                  ['Heidi','Jane','Kayley']]
# For each element in list_of_lists, take each element in the list
flattened_list = [i for row in list_of_lists for i in row]
# View the flattened list
flattened_list<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1373534338358459, 'fraction_numerical': 0.03015075376884422, 'mean_word_length': 4.75, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '173301', 'license': 'CC0-1.0', 'n_tokens_mistral': 218, 'n_tokens_neox': 195, 'n_words': 53, 'path': 'docs/python/basics/flatten_list_of_lists.ipynb', 'repo_name': 'revgizmo-forks/ds_notes', 'size': '602'}