diff --git a/movies.py b/movies.py index f625d1c..e5f5670 100644 --- a/movies.py +++ b/movies.py @@ -30,8 +30,8 @@ def get_count_movies_month(self, month=''): if month.lower() in valid_months: variable = valid_months.get(month.lower()) condition = self._df_movies['release_date'].dt.strftime('%m') == variable - return {'month': month, - 'amount': f'{self._df_movies[condition]["title"].count()}'} + return {'mes': month, + 'cantidad': f'{self._df_movies[condition]["title"].count()}'} return {'message': f'Month not exists: {month}'} @@ -50,7 +50,7 @@ def get_count_movies_day(self, day=''): if day.lower() in valid_days: condition = self._df_movies['release_date'].dt.dayofweek == valid_days.get(day.lower()) - return {'day': day, 'amount': f'{self._df_movies[condition]["title"].count()}'} + return {'dia': day, 'cantidad': f'{self._df_movies[condition]["title"].count()}'} return {'message': f'Mes no existente: {day}'} @@ -68,9 +68,9 @@ def get_score_title(self, title=''): index = df_aux[df_aux == title.lower()].index if len(index.values) > 0: df_aux = self._df_movies.iloc[index][['title', 'release_year', 'popularity']] - return {'title': f'{df_aux["title"].values[0]}', - 'year': f'{df_aux["release_year"].values[0]}', - 'popularity': f'{df_aux["popularity"].values[0].round(1)}'} + return {'titulo': f'{df_aux["title"].values[0]}', + 'anio': f'{df_aux["release_year"].values[0]}', + 'popularidad': f'{df_aux["popularity"].values[0].round(1)}'} return {'message': f'Movie `{title}` not found'} @@ -90,10 +90,10 @@ def get_votes_title(self, title=''): df_aux = self._df_movies.iloc[index][['title', 'release_year', 'vote_count', 'vote_average']] if df_aux["vote_count"].values[0] >= 2000: - return {'title': f'{df_aux["title"].values[0]}', - 'year': f'{df_aux["release_year"].values[0]}', - 'total_votes': f'{int(df_aux["vote_count"].values[0])}', - 'average_votes': f'{df_aux["vote_average"].values[0].round(1)}'} + return {'titulo': f'{df_aux["title"].values[0]}', + 'anio': f'{df_aux["release_year"].values[0]}', + 'voto_total': f'{int(df_aux["vote_count"].values[0])}', + 'voto_promedio': f'{df_aux["vote_average"].values[0].round(1)}'} return {'message': f'Movie `{title}` has not enough votes'} @@ -124,9 +124,9 @@ def get_actor(self, actor=''): max_value = max(return_list) index_max_return = index_list[return_list.index(max_value)] return {'actor': actor, - 'movie_count': f'{movies_count}', - 'max_return': f'{self._df_movies.iloc[index_max_return]["return"].round(1)}', - 'average_return': f'{ret_mean}'} + 'cantidad_filmaciones': f'{movies_count}', + 'retorno_total': f'{self._df_movies.iloc[index_max_return]["return"].round(1)}', + 'retorno_promedio': f'{ret_mean}'} return {'message': f'Actor `{actor}` not found'} @@ -152,12 +152,11 @@ def get_director(self, director=''): index_var = index_list[ret_list.index(max_value)] return {'director': director, - 'max_return_title': f'{self._df_movies.iloc[index_var]["title"]}', - 'max_return': f'{self._df_movies.iloc[index_var]["return"].round(1)}', - 'movies': f'{m_list}', - 'year': f'{d_list}', - 'return_movie': f'{ret_list}', - 'budget_movie': f'{c_list}', - 'revenue_movie': f'{rev_list}'} + 'retorno_total_director': f'{self._df_movies.iloc[index_var]["return"].round(1)}', + 'peliculas': f'{m_list}', + 'anio': f'{d_list}', + 'retorno_pelicula': f'{ret_list}', + 'budget_pelicula': f'{c_list}', + 'revenue_pelicula': f'{rev_list}'} return {'message': f'Director `{director}` not found'}