<jupyter_start><jupyter_text>Observations and Insights Capomulin is a promising drug candidate for this kind of tumor and warrants further investigation from this clinical trial's data analysis results.Capomulin also had the most number of mice complete the study.<jupyter_code># Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as st

# Study data files
mouse_metadata = "data/Mouse_metadata.csv"
study_results = "data/Study_results.csv"

# Read the mouse data and the study results
mouse_metadata = pd.read_csv(mouse_metadata)
study_results = pd.read_csv(study_results)

# Combine the data into a single dataset
cmpD = pd.merge(mouse_metadata, study_results,on='Mouse ID',how='left')
## Summary statistics
# enable display of all columns and rows:
pd.options.display.max_columns = None
pd.options.display.max_rows = None

print(cmpD.head())
print()

#Check g989 to see if its listed for more than one drug
study_data_mice = mouse_metadata.set_index('Mouse ID')
mouse = study_data_mice.loc['g989', :]
print('check g989 to see if its listed for more than one drug: ')
print(mouse.head())
print()
# Generate a summary statistics table of mean, median, variance, standard deviation, and SEM of the tumor volume for each regimen
print('Summary stats: ')
tumor_sump= cmpD.groupby("Drug Regimen").agg(['mean', 'median','var','std','sem'])["Tumor Volume (mm3)"]
print(tumor_sump.head())
print()<jupyter_output>Summary stats: 
                   mean     median        var       std       sem
Drug Regimen                                                     
Capomulin     40.675741  41.557809  24.947764  4.994774  0.329346
Ceftamin      52.591172  51.776157  39.290177  6.268188  0.469821
Infubinol     52.884795  51.820584  43.128684  6.567243  0.492236
Ketapril      55.235638  53.698743  68.553577  8.279709  0.603860
Naftisol      54.331565  52.509285  66.173479  8.134708  0.596466<jupyter_text>Bar plots<jupyter_code># Generate a bar plot showing number of data points for each treatment regimen using pandas
ptsByRegimen = pd.DataFrame(cmpD.groupby('Drug Regimen').count())
print('ptsByRegimen: ')
print(ptsByRegimen.head())
print()
print()
ptsByRegimen.plot(kind='bar')

# Generate a bar plot showing number of data points for each treatment regimen using pyplot
ptsByRegimen = cmpD.groupby('Drug Regimen').size()
ax = ptsByRegimen.plot(kind='bar', lw=2, colormap='Paired', title='Data Points by Drug Regimen')
#ax.set_xlabel("x label")
ax.set_ylabel("Data Points")
#ax.show()
# Generate a pie plot showing the distribution of female versus male mice using pandas
mouse_gender= cmpD.groupby('Sex').size()


print('head: ') 
print(mouse_gender.head(20))
print()
print('tail: ')
print(mouse_gender.tail(20))
print()


# Generate a pie plot showing the distribution of female versus male mice using pyplot

labels = 'Females', 'Males'

explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')

fig1, ax1 = plt.subplots()
ax1.pie(mouse_gender, labels=labels, autopct='%1.1f%%')
ax1.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.

plt.show()<jupyter_output><empty_output><jupyter_text>Quartiles, outliers and boxplots<jupyter_code># Calculate the final tumor volume of each mouse across four of the most promising treatment regimens. Calculate the IQR and quantitatively determine if there are any potential outliers. 

tumor_volume4 = cmpD[['Drug Regimen','Tumor Volume (mm3)']]


# Preview DataFrame
print()
print(tumor_volume4.head())
print()


tumor_volume4 = tumor_volume4.sort_values('Tumor Volume (mm3)')
# Preview DataFrame
print()
print(tumor_volume4.head())
print()


tumor_volume4 = tumor_volume4.sort_values('Drug Regimen')
# Preview DataFrame
print()
print(tumor_volume4.head())
print()

# Generate a box plot of the final tumor volume of each mouse across four regimens of interest<jupyter_output><empty_output><jupyter_text>Line and scatter plots<jupyter_code># Generate a scatter plot of mouse weight versus average tumor volume for the Capomulin regimen
# Calculate the correlation coefficient and linear regression model for mouse weight and average tumor volume for the Capomulin regimen<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09831793413882967, 'fraction_numerical': 0.05377872542051647, 'mean_word_length': 4.888423988842399, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '324500', 'license': 'ADSL', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1328, 'n_words': 432, 'path': 'pymaceuticals_starter.ipynb', 'repo_name': 'dejesax1219/Matplotlib-Challenge', 'size': '4221'}