Plotting a cumulative distribution function
Another interesting plot that we can create is one showing cumulative distribution. This plot shows the probability of finding a number in a bin or any lower bin. We do this by adding a single argument to the hist()
function.
How to do it…
- To create a cumulative distribution plot for a single column in a Pandas DataFrame, begin by importing all the required libraries. To show the
matplotlib
plots in IPython Notebook, we will use an IPython magic function which starts with%
:%matplotlib inline import pandas as pd import numpy as np from pymongo import MongoClient import matplotlib as mpl import matplotlib.pyplot as plt
- Next, connect to MongoDB and run a query specifying the five fields to be retrieved from ...
Get Python Business Intelligence Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.