<jupyter_start><jupyter_text>Histograms using MatPlotLib!<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

%matplotlib inline<jupyter_output><empty_output><jupyter_text>Bins   Changing the number of bins In order to set the number of bins you do: `n, bins, patches = plt.hist(data, bins = number_of_bins)` Where number_of_bins represents the total number of bins you want.<jupyter_code>x = [21,22,23,4,5,6,77,8,9,10,31,32,33,34,35,36,37,18,49,50,100]
num_bins = 15
n, bins, patches = plt.hist(x, bins = num_bins)
num_bins = 10
n, bins, patches = plt.hist(x, bins = num_bins)<jupyter_output><empty_output><jupyter_text>Changing the size of bins There are 2 ways to change the size of bins. 1st is to set a range of values for the bins. 2nd is to set a specific bin width.  Setting arbitary values for the bins The bins when you use ranges are left inclusive and right exclusive. In orther words [3,10) would include 3 but exclude 10. You would create an array of ranges like this: [smallest_value_in_the_set, specific_value, specific_value, largest_value_plus_1]Example: data = [0,1,2,3,90, 120, 100, 50, 75] If you wanted a bin that contained 0,1,2,3 a bin that contained 50, 75, 90 and a bin that contained 100 and 120, then you would do this:`bins = [0,50,100, 121]`<jupyter_code>data = [0,1,2,3,90, 120, 100, 50, 75]
bins_range = [0,50,100, 121] 
plt.hist(data, bins = bins_range)
plt.show()<jupyter_output><empty_output><jupyter_text>Another way to show this more clearly would be to put the minimum value for each bin and then the maximum value + 1.<jupyter_code>bins_range = [0,4,50,91,100, 121] 
plt.hist(data, bins = bins_range)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10277613703484938, 'fraction_numerical': 0.07737743650324867, 'mean_word_length': 5.830645161290323, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '121150', 'license': 'MIT', 'n_tokens_mistral': 716, 'n_tokens_neox': 600, 'n_words': 210, 'path': 'Historgrams.ipynb', 'repo_name': 'EmilyClaire/Histograms', 'size': '1693'}