Question: Can you help me to find what is the error? Jungkook is a dataframe by using panda liberary. Please solve the question by using panda.

Can you help me to find what is the error? Jungkook is a dataframe by using panda liberary. Please solve the question by using panda. Beacause Jungkook is very large (more than 40000 rows) I'll only show you the first two row by using head function.

Can you help me to find what is the error? Jungkook isa dataframe by using panda liberary. Please solve the question by using

3.2 You might have noticed that the data of the genres column is represented as a list of dictionaries. Let's change this format into an easier one. Write code to convert the values of genres column into a list of strings instead of a list of dictionaries, keeping only the value of the "name" attribute. For example, the value Fid': 16, 'name': 'Animation', [id: 35, 'name': 'Comedy1, tid: 10751, 'name: 'Family')l should be ['Animation', Comedey,Family]. The newly converted values should be stored in an extra new column called "genres_cleaned". (4 Marks) You should display the first 5 rows of the movies dataframe after adding this new column. The output of this question should be in the following format: Q3.2 The first 5 rows after adding the "genres_cleaned" column are: where # is the first 5 rows in the movies dataframe In [29]: def dictolist(list_of_dic): for i in range (,len(list_of_dic)): a.append(list_of_dic[i]["name"]) return (a) In [49]: ### answer 03.2 def dictolist (list_of_dic): for i in range(e,len(list_of_dic)): a.append(list_of dic[i]["name"]) return(a) Jungkook[ genres_cleaned'-Jungkook.genres.apply(dictolist) Traceback (most recent call last) TypeError in () 19 11 Jungkook[ 'genres_cleaned'-Jungkook.genres.apply (dictolist) Anaconda3\liblsite-packages\pandas\corelseries.py in apply(self, func, convert_dtype, args,**kwds) 3190 3191 ->3192 3193 3194 else: valuesself.astype (object).values mapped-lib.map_infer(values, f, convert-convert_dtype) if len (mapped) and isinstance (mapped[e], Series) pandas/_libs/src\inference.pyx in pandas._libs.lib.map_infer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!