-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
30 lines (26 loc) · 1.15 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pandas as pd
pd.set_option('display.max_colwidth', None)
#from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import matplotlib.pyplot as plt
import scipy.spatial.distance as dist
import numpy as np
from dask import dataframe as dd
import timeit
def get_movies():
url = 'https://drive.google.com/file/d/1WRAizHFm1UjxXEusUK4506QIffLkRzlJ/view?usp=sharing'
file_id=url.split('/')[-2]
dwn_url='https://drive.google.com/uc?id=' + file_id
df = pd.read_csv(dwn_url)
return df.to_json()
def get_movies_by_id(id):
url = 'https://drive.google.com/file/d/1WRAizHFm1UjxXEusUK4506QIffLkRzlJ/view?usp=sharing'
file_id=url.split('/')[-2]
dwn_url='https://drive.google.com/uc?id=' + file_id
df = pd.read_csv(dwn_url)
return df[df.movieId == id].to_json()
def get_movies_by_movieId_userId(movieId, imdbId):
url = 'https://drive.google.com/file/d/1WRAizHFm1UjxXEusUK4506QIffLkRzlJ/view?usp=sharing'
file_id=url.split('/')[-2]
dwn_url='https://drive.google.com/uc?id=' + file_id
df = pd.read_csv(dwn_url)
return df[(df.movieId == movieId) & (df.imdbId == imdbId)].to_json()