<jupyter_start><jupyter_text>Intro to Machine Learning - Case Study-1 1. Data Loading:a. Load the dataset “prisoners.csv” using pandas and display the first and last five rows in the dataset.[Hint: Refer to read_csv, head and tail methods in pandas]b. Use describe method in pandas and find out the number of columns. Can you say something about those rows who have zero inmates?[Hint: Use the loc attribute of dataframe combined with conditional checks]2. Data Manipulation:a. Create a new column -’total_benefitted’ that is a sum of inmates benefitted through all modes.[Hint: Use sum method with appropriate axis]b. Create a new row - “totals” that is the sum of all inmates benefitted through each mode across all states.3. Plotting:a. Make a bar plot with each state name on the x -axis and their total benefitted inmates as their bar heights. Which state has the maximum number of beneficiaries?[Hint: Use bar method of pyplot]b. Make a pie chart that depicts the ratio among different modes of benefits.[Hint: Use pie method of pyplot]<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
dfprisoners = pd.read_csv("prisoners.csv")
dfprisoners.shape
dfprisoners.head(5)
dfprisoners.shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05559906029757244, 'fraction_numerical': 0.003915426781519186, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '601657', 'license': 'MIT', 'n_tokens_mistral': 355, 'n_tokens_neox': 340, 'n_words': 183, 'path': 'Cls3-Intro To Machine Learning/.ipynb_checkpoints/Case Study I - Solution-checkpoint.ipynb', 'repo_name': 'tuhinssam/MLResources', 'size': '1277'}