"""
Hello, it is my test notebook. Simple visualisation how law of large numbers works for beginners :)

The law of large numbers states that an observed sample average from a large sample will be close to the true population average and that it will get closer the larger the sample.
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style("darkgrid")
"""
Let us create a dice with Pandas
"""
dice = pd.Series([1, 2, 3, 4, 5, 6])
dice.to_frame()
"""
And now we can find `mean` of our dice
"""
print('Avg of our dice is:', dice.mean())
def monte_carlo(series_list, n):
    result = []
    for i in range(1,n):
        result.append(series_list.sample(i, replace=True).mean())
    pd.Series(result).plot()
    plt.show()
    print('Avg of our dice is:', sum(result) / len(result))
"""
For five rolls avg looks like that:
"""
monte_carlo(dice, 5)
"""
Let us do more rolls
"""
monte_carlo(dice, 10)
"""
And more!
"""
monte_carlo(dice, 100)
monte_carlo(dice, 1000)
"""
And if we roll dice 10 000 times - the avg is almost equally to the true avg - 3.5
"""
monte_carlo(dice, 10000)
"""
The result becomes closer to the expected value as the number of trials is increased. Thus, I understood how it works. Very good mentor explained to me it in this way, maybe it will be useful to someone
"""