Visualizing histograms in Python
We can now begin developing a histogram with Python since we have established an appropriate data structure with a dataframe
. One of the most popular and powerful plotting libraries in Python is matplotlib
. If you are familiar with the programming language Matlab, then you will find matplotlib
to be a very quick study.
Note
To learn more about matplotlib
, visit the following website:
http://matplotlib.org
Before we can get started using matplotlib
, we will first need to install it either through PyCharm or through the command line:
pip install matplotlib
Next, we will need to import the module and call the %matplotlib inline
function to view plots directly inside of the Jupyter Notebook:
import matplotlib.pyplot as plt %matplotlib inline
We will now create a new dataframe
based on our existing one using only the column for VacationHours
. We can now visualize our histogram using VacationHours
for the plot points, with the plt.hist()
function from matplotlib...