concept dispersion in category data

This is an excerpt from Manning's book Data Science Bookcamp: Five Python Projects.
Dispersion is the scattering of data-points around some central value. A smaller dispersion is indicative of more predictable data. A larger dispersion is indicative of greater data fluctuations. Consider a scenario where we measure the summer temperatures in California and Kentucky. We gather 3 measurements for each state. Our measured California temperatures are 52, 77, and 96 degrees. Our measured Kentucky temperatures are 71, 75, and 79 degrees. We’ll store these measured temperatures and compute their means.
The means of the 2 measurement arrays both equal 75. California and Kentucky appear to share the same central temperature value. Despite this, the 2 measurement arrays are far from equal. The California temperatures are much more dispersed and unpredictable. They range from 52 to 96 degrees. Meanwhile, the stable Kentucky temperatures range from the low 70s to high 70s. They are more closely centered around the mean. We’ll visualize this difference in dispersion by plotting the 2 measurement arrays. Additionally, we’ll demarcate the mean by plotting a horizontal line.
Listing 5.27. Visualizing the difference in dispersion
plt.plot(range(3), california, color='b', label='California') plt.scatter(range(3), california, color='b') plt.plot(range(3), kentucky, color='r', linestyle='-.', label='Kentucky') plt.scatter(range(3), kentucky, color='r') plt.axhline(75, color='k', linestyle='--', label='Mean') plt.legend() plt.show()