Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import calendar
- months_list = [calendar.month_name[i] for i in range(1, 13)]
- class InconsistentDataError(Exception):
- pass
- def get_most_profitable_month_name(
- amounts_of_sold_subscriptions: np.ndarray,
- subscriptions_prices: np.ndarray,
- ) -> str:
- if amounts_of_sold_subscriptions.shape[1] != subscriptions_prices.shape[1]:
- raise InconsistentDataError
- income = amounts_of_sold_subscriptions * subscriptions_prices
- sold_per_month = np.sum(income, axis = 1)
- max_id = np.argmax(sold_per_month)
- return months_list[max_id]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement