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
- sold_per_month = np.sum(amounts_of_sold_subscriptions, axis = 1)
- print("sold_per_month")
- print(sold_per_month)
- indices = np.argsort(sold_per_month)
- print("indices")
- print(indices)
- return months_list[indices[11]]
- array = np.random.randint(-10, 10, size=(12, 3))
- price = np.random.randint(1, 10, size=(1, 3))
- print("array")
- print(array)
- k = get_most_profitable_month_name(array, price)
- print("k", k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement