An open API service indexing awesome lists of open source software.

https://github.com/vara-co/matplotlib-challenge

Pymaceuticals - Analysis of Tumor Response to Drug Regimens in Mice
https://github.com/vara-co/matplotlib-challenge

matplotlib matplotlib-pyplot matplotlib-python scatter-plot statistical-analysis summary-statistics

Last synced: 7 months ago
JSON representation

Pymaceuticals - Analysis of Tumor Response to Drug Regimens in Mice

Awesome Lists containing this project

README

          

--------------------------------
--------------------------------
Matplotlib Challenge
--------------------------------
--------------------------------
by Laura Vara
--------------------------------
![Pymaceuticals](https://github.com/vara-co/Matplotlib-challenge/assets/152572519/68f37861-d33a-429c-bb9b-fa18cf5bbdd9)

Note: It is important that if you are going to use this code, the csv files
are placed in a directory called Data, in the same directory as your
main Jupyter Notebook files. Otherwise the code with the path were you intend to read
your csv file, needs to be updated to where the new path is located for the
csv files. Ideally they will be set in the same way they are found in this repository.

This repository consists of a challenge created using Pandas and Matplotlib via Jupyter Notebook:
---------------------------------
INDEX
---------------------------------
1. Content of the repository
2. Instructions for the Matplotlib Challenge
3. References

---------------------------------
Content of the repository
---------------------------------
1. Pymaceuticals
- Data directory:
- Mouse_metadata.csv file
- Study_results.csv file
- pymaceuticals_starterLMVS.ipynb <-- Jupyter Notebook file with the code for the analysis, which also includes the written analysis.
- Pymaceuticals_AnalysisLMVS.txt <-- Written analysis formated in Text. This version allows you to view the results directly on GitHub

----------------------------------
Instructions for Pymaceuticals
----------------------------------
What good is data without a good plot to tell the story?
In this assignment, you’ll apply what you've learned about Matplotlib to a real-world situation and dataset.

**Background**
You've just joined Pymaceuticals, Inc., a new pharmaceutical company that specializes in anti-cancer medications. Recently, it began screening for potential treatments for squamous cell carcinoma (SCC), a commonly occurring form of skin cancer.

As a senior data analyst at the company, you've been given access to the complete data from their most recent animal study. In this study, 249 mice who were identified with SCC tumors received treatment with a range of drug regimens. Over the course of 45 days, tumor development was observed and measured. The purpose of this study was to compare the performance of Pymaceuticals’ drug of interest, Capomulin, against the other treatment regimens.

The executive team has tasked you with generating all of the tables and figures needed for the technical report of the clinical study. They have also asked you for a top-level summary of the study results.

**Files**
Download the following files to help you get started:
Module 5 Challenge filesLinks

**Instructions**
This assignment is broken down into the following tasks:

**Prepare the data**
- Generate summary statistics.
- Create bar charts and pie charts.
- Calculate quartiles, find outliers, and create a box plot.
- Create a line plot and a scatter plot.
- Calculate correlation and regression.
- Submit your final analysis.

**Prepare the Data**
- Run the provided package dependency and data imports, and then merge the mouse_metadata and study_results DataFrames into a single DataFrame.
- Display the number of unique mice IDs in the data, and then check for any mouse ID with duplicate time points. Display the data associated with that mouse ID, and then create a new DataFrame where this data is removed. Use this cleaned DataFrame for the remaining steps.
- Display the updated number of unique mice IDs.

**Generate Summary Statistics**
- Create a DataFrame of summary statistics. Remember, there is more than one method to produce the results you're after, so the method you use is less important than the result.
- Your summary statistics should include:
- A row for each drug regimen. These regimen names should be contained in the index column.
- A column for each of the following statistics: mean, median, variance, standard deviation, and SEM of the tumor volume.

**Create Bar Charts and Pie Charts**
- Generate two bar charts. Both charts should be identical and show the total total number of rows (Mouse ID/Timepoints) for each drug regimen throughout the study.
- Create the first bar chart with the Pandas DataFrame.plot() method.
- Create the second bar chart with Matplotlib's pyplot methods.
- Generate two pie charts. Both charts should be identical and show the distribution of female versus male mice in the study.
- Create the first pie chart with the Pandas DataFrame.plot() method.
- Create the second pie chart with Matplotlib's pyplot methods.

**Calculate Quartiles, Find Outliers, and Create a Box Plot**
- Calculate the final tumor volume of each mouse across four of the most promising treatment regimens: Capomulin, Ramicane, Infubinol, and Ceftamin. Then, calculate the quartiles and IQR, and determine if there are any potential outliers across all four treatment regimens. Use the following substeps:
- Create a grouped DataFrame that shows the last (greatest) time point for each mouse. Merge this grouped DataFrame with the original cleaned DataFrame.
- Create a list that holds the treatment names as well as a second, empty list to hold the tumor volume data.
- Loop through each drug in the treatment list, locating the rows in the merged DataFrame that correspond to each treatment. Append the resulting final tumor volumes for each drug to the empty list.
- Determine outliers by using the upper and lower bounds, and then print the results.
- Using Matplotlib, generate a box plot that shows the distribution of the final tumor volume for all the mice in each treatment group. Highlight any potential outliers in the plot by changing their color and style.
hint: All four box plots should be within the same figure. Use this Matplotlib documentation pageLinks to an external site. for help with changing the style of the outliers.

**Create a Line Plot and a Scatter Plot**
- Select a single mouse that was treated with Capomulin, and generate a line plot of tumor volume versus time point for that mouse.
- Generate a scatter plot of mouse weight versus average observed tumor volume for the entire Capomulin treatment regimen.

**Calculate Correlation and Regression**
- Calculate the correlation coefficient and linear regression model between mouse weight and average observed tumor volume for the entire Capomulin treatment regimen.
- Plot the linear regression model on top of the previous scatter plot.

------------------------------------
References for PyCitySchools
------------------------------------
Most of what's in this challenge, was covered in class.
The few things that either weren't or I had to reference to, are described
with it's source right below.

Nunique Method **.nunique()** resources:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.nunique.html

Drop Duplicates method **.drop_duplicates()** resources:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html

Getting data from duplicates using **.isin()** method resources:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.isin.html

Using the aggregation **.agg()** method resources:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.agg.html
https://pbpython.com/groupby-agg.html