Movie lens data analysis - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Movie lens data analysis (/thread-24551.html) |
Movie lens data analysis - sekhar_desiraju - Feb-19-2020 Data set screenshot how can i find the number of movies per genre using the item data movies that have more than one genre drop the movie where genre is unknown RE: Movie lens data analysis - satyashetty - Feb-19-2020
RE: Movie lens data analysis - sekhar_desiraju - Feb-19-2020 hi satya, thank you for your reply really appriciate, i dont have any programming background so struggling a bit on this i have used df=pd.DataFrame({'Genre':['unknown','Action','Adventure','Animation','Childrens','Comedy','Crime','Documentary','Drama','Fantasy','Film-Noir','Horror','Musical','Mystery','Romance','Sci-Fi','Thriller','War','Western']}, index=['movie title']) df.set_index(["unknown","Action","Adventure","Animation","Childrens","Comedy","Crime","Documentary","Drama","Fantasy","Film-Noir","Horror","Musical","Mystery","Romance","Sci-Fi","Thriller","War","Western"]).count(level="movie title") but its not working am doing any thing wrong those columns of genre if they are as rows corresponding to movie name probably would have been easy one hot coding changed the rows to columns i dont know how to put that columns to rows again Oh sorry .. my bad .. didnt know it was suppose to be done like that.. corrected df=pd.DataFrame({'Genre': ['unknown','Action','Adventure','Animation','Childrens','Comedy','Crime','Documentary','Drama','Fantasy','Film-Noir','Horror','Musical','Mystery','Romance','Sci-Fi','Thriller','War','Western']}, index=['movie title']) df.set_index(["unknown","Action","Adventure","Animation","Childrens","Comedy","Crime","Documentary","Drama","Fantasy","Film-Noir","Horror","Musical","Mystery","Romance","Sci-Fi","Thriller","War","Western"]).count(level="movie title") RE: Movie lens data analysis - link_static - Oct-28-2020 (Feb-19-2020, 02:36 PM)sekhar_desiraju Wrote: hi satya, I tried to work with the lines of code to solve the same problem but it is not returning the right solution. Any reason why this is the case? RE: Movie lens data analysis - kakkarshivam - Nov-29-2020 Hi There, Can you please share the code here as well for the question movies that have more than one Genre. My answer is coming zero. Not sure Looking forward to hear from you! Thanks! SHivam |