%matplotlib inline import matplotlib.pyplot as plt import pandas as pd url = "http://mlr.cs.umass.edu/ml/machine-learning-databases/iris/iris.data" # Define our headers since the url doesn't contain explicit headers # I found these headers from looking at the documentation at # http://mlr.cs.umass.edu/ml/machine-learning-databases/iris/iris.names headers = ['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width', 'Class' ] iris = pd.read_csv(url, header=None, names=headers) iris[:3] # I use two brackets around 'Sepal Length' to force pandas to make this # a data frame rather than just a series, which is like a numpy array. # The brackets here aren't necessary, but makes printing sepal_lengths # prettier and makes it easier for us to combine sepal_lengths with other # data. sepal_lengths = iris[['Sepal Length']] # Make the plot pretty! pd.set_option('display.mpl_style', 'default') sepal_lengths.hist()