<jupyter_start><jupyter_text>Map violations data  Set up environment<jupyter_code># Install paretochart
!pip install --upgrade paretochart

# Import necessary packages 
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np


%matplotlib inline
# Troubleshooting issue with notebook not being able to import pareto module
import sys
# sys.path.append('/Users/davidplewis/anaconda3/lib/python3.6/site-packages/paretochart')
# sys.path.pop(6)
sys.path

sys.path
from paretochart import paretochart<jupyter_output><empty_output><jupyter_text>Import and clean data<jupyter_code># Import violations data
import os.path
root_path = os.path.dirname(os.getcwd())
violation_values  = pd.read_csv(os.path.join(root_path,"DATA/violation_values.csv"))
violation_counts  = pd.read_csv(os.path.join(root_path,"DATA/violation_counts.csv"))

violation_values.head()
violation_columns = (list(violation_values.columns))
violation_columns.remove("inspection_id")
violation_sums = violation_values[violation_columns].sum()
violation_sums = pd.DataFrame({'violation':violation_sums.index, 'count':violation_sums.values})
violation_sums<jupyter_output><empty_output><jupyter_text>Graph Violations<jupyter_code># Make pareto chart from violation sums
data = violation_sums["count"].values.tolist()
labels = violation_sums["violation"].values.tolist()
test_data = [21, 2, 10, 4, 16]

# fig, axes = plt.subplots(2, 2)

chart = paretochart.pareto(data, labels, limit=.8, line_args=('g',))
# plt.title('Basic chart without labels', fontsize=10)
plt.rcParams["figure.figsize"] = (20,3)
# Make bar graph of violation sums

violation_graph =violation_sums.plot(kind="bar", figsize=(10,7))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11862464183381088, 'fraction_numerical': 0.013180515759312322, 'mean_word_length': 7.600985221674877, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '64880', 'license': 'MIT', 'n_tokens_mistral': 629, 'n_tokens_neox': 608, 'n_words': 122, 'path': 'maps_and_plots/21_plot_violations.ipynb', 'repo_name': 'Sustainabilist/ChicagoDataAnalysis', 'size': '1745'}