<jupyter_start><jupyter_text>Monte Carlo - Predicting Gross Profit - Part II *Suggested Answers follow (usually there are multiple ways to solve a problem in Python).* Proceed from where we left off on the previous exercise.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt

rev_m = 200
rev_stdev = 10
iterations = 256

rev = np.random.normal(rev_m, rev_stdev, iterations)
COGS = - (rev * np.random.normal(0.4,0.2))

COGS.mean(), COGS.std()<jupyter_output><empty_output><jupyter_text>**** Based on the predicted revenue and Cogs values, estimate the expected Gross Profit of your company.  *Reminder: Be careful about estimating the gross profit. If you have stored the Cogs value as a negative number, the gross profit will equal revenues plus Cogs. If you have created Cogs as a positive value, then gross profit would be equal to revenues minus Cogs. Either way, you will obtain the same result for gross profit.*<jupyter_code>Gross_Profit = rev + COGS
Gross_Profit
plt.figure(figsize=(15, 6))
plt.plot(Gross_Profit)
plt.show()<jupyter_output><empty_output><jupyter_text>What is the maximum and what is the minimum gross profit value you obtained?<jupyter_code>max(Gross_Profit)
min(Gross_Profit)<jupyter_output><empty_output><jupyter_text>What is its mean and standard deviation?<jupyter_code>Gross_Profit.mean()
Gross_Profit.std()<jupyter_output><empty_output><jupyter_text>Do you remember what a histogram is? Plot the gross profit data on a histogram. Use 20 bins directly to check the distribution of the data.<jupyter_code>plt.figure(figsize=(10, 6));
plt.hist(Gross_Profit, bins = 20);
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08661417322834646, 'fraction_numerical': 0.013325257419745608, 'mean_word_length': 6.213973799126638, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '104915', 'license': 'Apache-2.0', 'n_tokens_mistral': 566, 'n_tokens_neox': 527, 'n_words': 184, 'path': '23 - Python for Finance/8_Monte Carlo Simulations as a Decision-Making Tool/5_Monte Carlo: Predicting Gross Profit - Part II (2:56)/MC - Predicting Gross Profit - Part II - Solution.ipynb', 'repo_name': 'olayinka04/365-data-science-courses', 'size': '1651'}