Created
June 6, 2020 11:49
-
-
Save Lawrence-Krukrubo/3a1300f96148176984b1535e89c6b6b4 to your computer and use it in GitHub Desktop.
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 characters
import pandas as pd | |
import pickle | |
# Open pickle file and load data: | |
with open('ratings.pickle', 'rb') as f: | |
ratings_data = pickle.load(f) | |
# Print ratings_data | |
print(ratings_data) | |
# Print datatype of ratings_data | |
print(type(ratings_data)) | |
>> | |
ratings.csv | |
<class 'str'> | |
# Now let's load the ratings_data into a pandas data frame. As we can see, ratings_data contains the ratings.csv file | |
ratings_df = pd.read_csv(ratings_data) | |
# Now let's see the size of the ratings.df | |
print(ratings_df.shape)) | |
>> | |
(22884377, 4) | |
# Finally, let's see the first five rows | |
print(ratings_df.head()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment