Creating a Boxplot with Matplotlib

Viewed 45737

I am using python 3 and jupyter notebook. I have a pandas dataframe that is structured like this:

          location  price
Apr 25   ASHEVILLE   15.0
Apr 25   ASHEVILLE   45.0
Apr 25   ASHEVILLE   50.0
Apr 25   ASHEVILLE  120.0
Apr 25   ASHEVILLE  300.0
<class 'pandas.core.frame.DataFrame'>

I am simply trying to create a boxplot for each location to show the range of prices among items in each location.

When I ran the following code:

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline


plt.boxplot(postings)
plt.show()

It returned TypeError: unhashable type: 'slice'

3 Answers
Related