import pandas as pd
import matplotlib.pyplot as plt
dir(pd)
prisoner_df=pd.read_csv("prisoners.csv")
#Syntax to display last and first 5 rows of records
print(prisoner_df.tail())
print(prisoner_df.head())
dir(prisoner_df)
# Syntax to get only non zero values of rows
new_value=prisoner_df.iloc[:,[2,3,4,5]].mean(axis=1) >0
prisoner_df[new_value]
# create new columns
prisoner_df["total_benefitted"]=prisoner_df.sum(axis=1)
series_value=pd.Series(prisoner_df.sum(axis=0))
series_value
prisoner_df.append(series_value,ignore_index=True)
prisoner_df.at[35, "STATE/UT"]="Totals"
#Plotting
#plot with each state name on the x -axis and their total benefitted
plt.pie(prisoner_df.iloc[35:,[2,3,4,5,6]])