<jupyter_start><jupyter_text>Consumer Financial Protection Bureau Complaints<jupyter_code># Run this cell to set up the notebook, but please don't change it.

# These lines import the Numpy and Datascience modules.
import numpy as np
from datascience import *

# These lines do some fancy plotting magic.
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
import warnings
warnings.simplefilter('ignore', FutureWarning)<jupyter_output><empty_output><jupyter_text>The Consumer Financial Protection Bureau has collected and published consumer complaints against financial companies since 2011.  The data are available [here](https://dev.socrata.com/foundry/data.consumerfinance.gov/jhzv-w97w) (or at this [direct link](https://data.consumerfinance.gov/resource/jhzv-w97w.csv).  For this exercise, to make your code run faster, we've selected only the data from May 2016.Run the next cell to load the data.  Each row represents one consumer's complaint.<jupyter_code># Just run this cell.
complaints = Table.read_table("complaints.csv")
complaints<jupyter_output><empty_output><jupyter_text>**Question 1.** Financial companies offer a variety of products.  How many complaints were made against each kind of product?  Make a table called `complaints_per_product` with one row per product category and 2 columns: "product" (the name of the product) and "number of complaints" (the number of complaints made against that kind of product).<jupyter_code>complaints_per_product = ...
complaints_per_product<jupyter_output><empty_output><jupyter_text>**Question 2.** Make a bar chart showing how many complaints were made about each product category.<jupyter_code>...<jupyter_output><empty_output><jupyter_text>**Question 3.** Make a table of the number of complaints made against each *company*.  Call it `complaints_per_company`.  It should have one row per company and 2 columns: "company" (the name of the company) and "number of complaints" (the number of complaints made against that company).<jupyter_code>complaints_per_company = ...
complaints_per_company<jupyter_output><empty_output><jupyter_text>**Question 4.** It wouldn't be a good idea to make a bar chart of that data.  (Don't try it!)  Why not? *Write your answer here, replacing this text.* **Question 5.** Make a bar chart of just the companies with the most complaints.  Specifically, make a chart that displays the number of complaints against the companies with the 10 most complaints.<jupyter_code>...<jupyter_output><empty_output><jupyter_text>**Question 6.** Make a bar chart like the one above, with one difference: The size of each company's bar should be the *proportion* (among *all complaints* made against any company in `complaints`) that were made against that company.**Note:** Graphs aren't very useful without accurate labels.  Make sure that the text on the horizontal axis of the graph makes sense.<jupyter_code>...<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08069939475453934, 'fraction_numerical': 0.007397444519166106, 'mean_word_length': 5.87066974595843, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '428927', 'license': 'MIT', 'n_tokens_mistral': 854, 'n_tokens_neox': 805, 'n_words': 345, 'path': 'hw04/cfpb_complaints.ipynb', 'repo_name': 'marctollis/INF110-Discovering-Informatics', 'size': '2974'}