Skip to content

Instantly share code, notes, and snippets.

@Lawrence-Krukrubo
Created June 6, 2020 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lawrence-Krukrubo/3a1300f96148176984b1535e89c6b6b4 to your computer and use it in GitHub Desktop.
Save Lawrence-Krukrubo/3a1300f96148176984b1535e89c6b6b4 to your computer and use it in GitHub Desktop.
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