# Split a String into columns using regex in pandas DataFrame in Python # import the regex libraryimport pandas as pdimport re  # Create a list with all the stringsmovie_data = ["Name: The_Godfather Year: 1972 Rating: 9.2",            "Name: Bird_Box Year: 2018 Rating: 6.8",            "Name: Fight_Club Year: 1999 Rating: 8.8"]  # Create a dictionary with the required columns # Used later to convert to DataFramemovies = {"Name":[], "Year":[], "Rating":[]}  for item in movie_data:          # For Name field    name_field = re.search("Name: .*",item)          if name_field is not None:        name = re.search('\w*\s\w*',name_field.group())    else:        name = None    movies["Name"].append(name.group())          # For Year field    year_field = re.search("Year: .*",item)    if year_field is not None:        year = re.search('\s\d\d\d\d',year_field.group())    else:        year = None    movies["Year"].append(year.group().strip())          # For rating field    rating_field = re.search("Rating: .*",item)    if rating_field is not None:         rating = re.search('\s\d.\d',rating_field.group())    else:         rating - None    movies["Rating"].append(rating.group().strip())  # Creating DataFramedf = pd.DataFrame(movies)print(df)