示例#1
0
 def getMaxBoxOfficeFilm(self, filmNodes):
     maxVal = 0
     act = ''
     for node in filmNodes:
         if (float(FilmNode.getValue(node)) > maxVal):
             maxVal = float(FilmNode.getValue(node))
             act = FilmNode.getName(node)
     return act
示例#2
0
def show_age_gross_relation():
    ret = {}
    for film in InitGraph.filmNodes:
        if film is not None:
            value = FilmNode.getValue(film)
            name = FilmNode.getName(film)
            actors = GraphQuery.getActorsInFilm(GraphQuery(),
                                                InitGraph.filmNameDict, name)
            for actor in actors:
                if actor is not None:
                    for node in InitGraph.actorNodes:
                        if ActorNode.getName(node) == actor:
                            ret[ActorNode.getAge(node)] = value

    trace = go.Pie(labels=list(ret.keys()), values=list(ret.values()))
    py.plot([trace], filename='basic_pie_chart')
示例#3
0
def show_actor_earnings():
    ret = {}
    for film in InitGraph.filmNodes:
        if film is not None:
            value = float(FilmNode.getValue(film))
            name = FilmNode.getName(film)
            actors = GraphQuery.getActorsInFilm(GraphQuery(),
                                                InitGraph.filmNameDict, name)
            for actor in actors:
                if actor is not None:
                    if ret.get(actor) is None:
                        ret[actor] = 0.0
                    ret[actor] += value

    labels = list(ret.keys())
    values = list(ret.values())
    trace = go.Pie(labels=labels, values=values)
    py.plot([trace], filename='basic_pie_chart')
示例#4
0
 def getFilmValue(self, filmNodes, filmName):
     for node in filmNodes:
         if (FilmNode.getName(node) == filmName):
             return FilmNode.getValue(node)
示例#5
0
 def removeFilm(self, filmNodes, filmNameDict, filmName):
     for node in filmNodes:
         if FilmNode.getName(node) == filmName:
             filmNodes.remove(node)
             filmNameDict.pop(filmName)
示例#6
0
 def getOtherFilms(self, filmNodes, filmName):
     ret = []
     for node in filmNodes:
         if FilmNode.getName(node).find(filmName) == -1:
             ret.append(FilmNode.getName(node))
     return ret
示例#7
0
 def getAllFilmsInYear(self, filmNodes, year):
     ret = []
     for node in filmNodes:
         if FilmNode.getYear(node) == str(year):
             ret.append(FilmNode.getName(node))
     return ret