Question: Hello, this is a question that I have to answer for my project and I dont understand what to do. For the final answer we
Hello, this is a question that I have to answer for my project and I dont understand what to do. For the final answer we need a a function that removes parenthesis from the series "if there are any". Below is the DataFrame used for this problem

: jupyterhub midterm_project Last Checkpoint: Yesterday at 2:56 PM (unsaved changes) Question 3.1 1 point Notice that in the independents DataFrame, certain rows include the city name in parentheses as part of the restaurant name. An example is shown below. Jupyterhub midterm_project Last Checkpoint: Yesterday at 2:56 PM (unsaved changes) 1 point Notice that in the independents DataFrame, certain rows include the city name in parentheses as part of the restaurant name. An example is shown below. In [217]: Y independents.take ([3]) out [217] : This will be problematic if we try to merge the independents DataFrame and the ratings DataFrame, since ratings does not necessarily contain the city in parentheses in the 'Restaurant' column. To fix this, write a function called remove_location, which takes in a string value containing the restaurant name and removes any location information listed within parentheses. Example behavior of the function is shown below. remove location('Maple \& Ash (Chicago) ') 'Maple \& Ash' remove location( 'Beauty \& Essex (New York City)') 'Beauty \& Essex' remove location('Casa Tua Miami') 'Casa Tua Miami' Then, create two new DataFrames, independents_to_merge and ratings_to_merge with the same data is independents and ratings, except with no locations in parentheses in the 'Restaurant' column. Hints: - You may find the string method index() useful for this question. - Make sure to remove any spaces that may be in front of the parentheses
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
