forked from bzitkovic/intelligent-system-goodReads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgood_reads.py
54 lines (43 loc) · 1.28 KB
/
good_reads.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from pandas import read_csv, DataFrame
from scipy.sparse import data
from models import Book
from gui import GUI
from decision_tree_model import make_decision_tree, make_prediction_total_rating
from tkinter import Tk
from visualization import get_decision_tree
dataframe = read_csv("GoodReadsData.csv", delimiter=",")
# Remove all rows that contain NULL values
dataframe.dropna(inplace=True)
books = []
for index, row in dataframe.iterrows():
author = row["author"]
book_format = row["bookformat"]
description = row["desc"]
genres = row["genre"].split(",")
isbn = row["isbn"]
link = row["link"]
pages = row["pages"]
rating = row["rating"]
reviews = row["reviews"]
title = row["title"]
total_ratings = row["totalratings"]
new_book = Book(
author,
book_format,
description,
genres,
isbn,
link,
pages,
rating,
reviews,
title,
total_ratings,
)
books.append(new_book)
if __name__ == "__main__":
# above_total_rating = dataframe[(dataframe['totalratings'] > total_rating) & (dataframe['reviews'] == 1214)]
decision_tree = make_decision_tree(dataframe)
window = Tk()
gui = GUI(window, books, dataframe, decision_tree)
gui.window.mainloop()