Revisions
-
gabrielgrant revised this gist
Apr 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Assumes you've already downloaded the raw data by running: wget -O - ftp://ftp.funet.fi/pub/mirrors/ftp.imdb.com/pub/ratings.list.gz | gunzip > ratings.list See: http://www.imdb.com/interfaces """ import pandas as pd -
gabrielgrant revised this gist
Apr 25, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ Assumes you've already downloaded the raw data by running: wget -O - ftp://ftp.funet.fi/pub/mirrors/ftp.imdb.com/pub/ratings.list.gz | gunzip > ratings.list Details: http://www.imdb.com/interfaces """ import pandas as pd -
gabrielgrant revised this gist
Apr 25, 2015 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ """ Loads IMDB's Ratings data into Pandas Assumes you've already downloaded the raw data by running: wget -O - ftp://ftp.funet.fi/pub/mirrors/ftp.imdb.com/pub/ratings.list.gz | gunzip > ratings.list """ import pandas as pd # First, get a clean version of just the ratings data -
gabrielgrant revised this gist
Apr 25, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ import pandas as pd # First, get a clean version of just the ratings data -
gabrielgrant revised this gist
Apr 25, 2015 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ import pandas as pd # First, get a clean version of just the ratings data ratings = open('ratings.list').read() @@ -6,12 +9,10 @@ open('ratings.clean.list', 'w').write(ratings) # Now play titles, rating_data = ratings.split('\n', 1) titles = titles.split() rating_data_lines = rating_data.splitlines() # split the lines on whitespace, but not with str.split(), because we need to preserve leading spaces rating_data_split = [re.split(r"\s+", l, maxsplit=len(titles)-1) for l in rating_data_lines] ratings = pd.DataFrame(rating_data_split, columns=titles).convert_objects(convert_numeric=True) -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # First, get a clean version of just the ratings data ratings = open('ratings.list').read() _, ratings = ratings.split('MOVIE RATINGS REPORT\n\n') ratings, _ = ratings.split('\n\n------------------------------------------------------------------------------') open('ratings.clean.list', 'w').write(ratings) # Now play import pandas as pd titles, rating_data = ratings.split('\n', 1) titles = titles.split() rating_data_lines = rating_data.splitlines() rating_data_split = [re.split(r"\s+", l, maxsplit=len(titles)-1) for l in rating_data_lines] ratings = pd.DataFrame(rating_data_split, columns=titles).convert_objects(convert_numeric=True) ratings = pd.read_csv('ratings.clean.list', delimiter=r"\s\s+")