September 2019
Beginner to intermediate
494 pages
13h
English
Following our discussion on working with a scientific project in PyCharm, in the main.py file, we will input the following sample code:
import numpy as npimport matplotlib.pyplot as pltN = 100x = np.random.normal(0, 1, N)y = np.random.normal(2, 3, N)plt.hist(x, alpha=0.5, label='x')plt.hist(y, alpha=0.5, label='y')plt.legend(loc='upper right')plt.show()
Using NumPy, we are simply creating two sample 100-element datasets from normal distributions (x from a distribution with a mean of 0 and a standard deviation of 1, y from a distribution with a mean of 2 and a standard deviation of 3). Then, we draw their corresponding histograms using Matplotlib.
Now, execute the program. You will see the corresponding output appear in your ...
Read now
Unlock full access