<jupyter_start><jupyter_text>Iterating and concatenating all matchesNow that you have a list of filenames to load, you can load all the files into a list of DataFrames that can then be concatenated.You'll start with an empty list called frames. Your job is to use a for loop to:iterate through each of the filenamesread each filename into a DataFrame, and thenappend it to the frames list.You can then concatenate this list of DataFrames using pd.concat(). Go for it!Instructions100 XPWrite a for loop to iterate through csv_files:In each iteration of the loop, read csv into a DataFrame called df.After creating df, append it to the list frames using the .append() method.Concatenate frames into a single DataFrame called uber.Hit 'Submit Answer' to see the head and shape of the concatenated DataFrame!<jupyter_code>import glob
import pandas as pd
# Write the pattern: pattern
pattern = '*.txt'

# Save all file matches: csv_files
csv_files = glob.glob(pattern)

# Print the file names
print(csv_files)
# Create an empty list: frames
frames = []

#  Iterate over csv_files
for csv in csv_files:

    #  Read csv into a DataFrame: df
    df = pd.read_csv(csv)
    
    # Append df to frames
    frames.append(df)

# Concatenate frames into a single DataFrame: uber
uber = pd.concat(frames)
# Print the shape of uber
print(uber.shape)

# Print the head of uber
print(uber.head())<jupyter_output>(30, 8)
   berlin  chennai  chicago      city      date  day  humidity  temperature
0     NaN      NaN      NaN  new york  5/1/2017  NaN      56.0         65.0
1     NaN      NaN      NaN  new york  5/2/2017  NaN      58.0         66.0
2     NaN      NaN      NaN  new york  5/3/2017  NaN      60.0         68.0
3     NaN      NaN      NaN    mumbai  5/1/2017  NaN      80.0         75.0
4     NaN      NaN      NaN    mumbai  5/2/2017  NaN      83.0         78.0
{'fraction_non_alphanumeric': 0.05597416576964478, 'fraction_numerical': 0.03821313240043057, 'mean_word_length': 2.6739130434782608, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '542725', 'license': 'MIT', 'n_tokens_mistral': 634, 'n_tokens_neox': 562, 'n_words': 253, 'path': 'cleaning data in python/Combining data for analysis/04. Iterating and concatenating all matches.ipynb', 'repo_name': 'nazmusshakib121/Importing-Cleaning-Data-with-Python', 'size': '1858'}