Skip to content

Commit 30e762a

Browse files
committed
Update readme and notebooks
1 parent 989fc0d commit 30e762a

File tree

3 files changed

+92
-6
lines changed

3 files changed

+92
-6
lines changed

00-intro-to-pandas/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Introduction to Pandas
2+
3+
Below is a quick primer on pandas. The purpose of this markdown is to cover the basic concepts of pandas to set the context for the exercises that we will be undertaking in this workshop.
4+
5+
## What is Pandas?
6+
7+
Pandas is a powerful Python library used for data manipulation and analysis. It provides data structures and functions designed to work efficiently with structured data, particularly large and complex datasets.
8+
9+
## Key Features of Pandas
10+
11+
- **Data manipulation**: Perform basic and advanced data operations like merging, reshaping, selecting, as well as cleaning.
12+
- **Time Series**: Extensive support for date-time data for financial and time-series analysis.
13+
- **Handling Missing Data**: Convenient methods for detecting, removing, and replacing missing data.
14+
- **Efficient I/O Tools**: Tools for reading data from a variety of formats (CSV, Excel, JSON, etc.) and writing data.
15+
16+
## What is a DataFrame?
17+
18+
A DataFrame is a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). It is arguably the most central and widely used pandas object, akin to a spreadsheet.
19+
20+
### Creating a DataFrame
21+
22+
You can create a DataFrame from various sources such as a list, dictionary, or reading from a CSV file.
23+
24+
```python
25+
import pandas as pd
26+
27+
# Creating from a dictionary
28+
data = {'Name': ['John', 'Anna'], 'Age': [28, 22]}
29+
df = pd.DataFrame(data)
30+
31+
# Display the DataFrame
32+
print(df)
33+
```
34+
35+
### Basic DataFrame Operations
36+
- **Viewing Data**: df.head() to see the first few rows.
37+
- **Describing Data**: df.describe() to view summary statistics.
38+
- **Data Selection**: df['Column'] to select a column.
39+
40+
### Why Use Pandas?
41+
42+
Pandas simplifies tasks that are complex in other languages, enabling more readable, concise, and user-friendly data manipulation code. It is an indispensable tool for data scientists due to its powerful data processing capabilities and seamless integration with other libraries.
43+
44+
45+
### Further Learning
46+
47+
For more detailed exploration, consider checking out the [Pandas Documentation](https://pandas.pydata.org/docs/).
48+
49+
Also checkout an introductory guide on [Python for Data Analysis](https://wesmckinney.com/book/).

01-cancer-data-analysis/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This repository contains a collection of notebooks for the data analysis workflo
1414

1515
To get started with the cancer data analysis, follow these steps:
1616

17-
1. Clone this repository to your local machine.
17+
1. Ensure you have cloned the repository by following the steps in the [Getting Started section of the main README](../README.md#getting-started) of this repo.
1818
2. Open the notebooks in Visual Studio Code.
1919
3. Run the notebooks in the specified order (exploration, processing, visualization) to perform the complete data analysis workflow.
2020

01-cancer-data-analysis/fm-ad-notebook-processing.ipynb

+42-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"source": [
8585
"According to the dataset documentation, there are 18,004 records in the study. Additionally, results from section 2.6 of [fm-ad-notebook-exploration.ipynb](fm-ad-notebook-exploration.ipynb) indicate that the `case_id` column has 18,004 unique values.\n",
8686
"\n",
87-
"Moreover, other columns also have 18,004 unique values. These columns likely serve as unique identifiers similar to the `case_id` column, making them redundant.\n",
87+
"Moreover, other columns also have 18,004 unique values. These columns likely serve as unique identifiers similar to the `case_id` column. For the purposes of this workshop, we can assume they are redundant.\n",
8888
"\n",
8989
"Let's create a prompt to identify which of these columns fit this criterion."
9090
]
@@ -95,7 +95,7 @@
9595
"metadata": {},
9696
"outputs": [],
9797
"source": [
98-
"# list the name of columns that have more than or equal to 18004 unique values\n"
98+
"# list the name of columns that have more than or equal to 18004 unique values"
9999
]
100100
},
101101
{
@@ -175,7 +175,7 @@
175175
"cell_type": "markdown",
176176
"metadata": {},
177177
"source": [
178-
"We saw in section 2.7 of the `fm-ad-notebook-exploration.ipynb` notebook that there were duplicate records. Let's go ahead and drop them."
178+
"We saw in section 2.7 of [fm-ad-notebook-exploration.ipynb](fm-ad-notebook-exploration.ipynb) notebook that there were duplicate records. Let's go ahead and drop them."
179179
]
180180
},
181181
{
@@ -207,7 +207,7 @@
207207
"cell_type": "markdown",
208208
"metadata": {},
209209
"source": [
210-
"In section 2.7, you saw that there were records that shared the same case_id. Let's check if there are any other records share a case_id.\n"
210+
"In section 2.7, you saw that there were records that shared the same `case_id`. Let's check if there are any other records share a `case_id`.\n"
211211
]
212212
},
213213
{
@@ -219,6 +219,13 @@
219219
"# count how many records share the same case_id"
220220
]
221221
},
222+
{
223+
"cell_type": "markdown",
224+
"metadata": {},
225+
"source": [
226+
"Let's take a look at a visual representation of the distribution of the number of records that are shared by `case_id`'s."
227+
]
228+
},
222229
{
223230
"cell_type": "code",
224231
"execution_count": null,
@@ -232,7 +239,7 @@
232239
"cell_type": "markdown",
233240
"metadata": {},
234241
"source": [
235-
"Let's take a look at the instance where a case_id is shared between records.\n",
242+
"Let's take a look at the list of records shared by a particular `case_id`.\n",
236243
"\n",
237244
"Create a prompt below to generate code to show you records that shares a case_id different from the case_id in section 2.7 of [fm-ad-notebook-exploration.ipynb](fm-ad-notebook-exploration.ipynb)."
238245
]
@@ -246,6 +253,15 @@
246253
"# show the records with the case_id aff95088-8760-46d2-a404-b545807e0735"
247254
]
248255
},
256+
{
257+
"cell_type": "markdown",
258+
"metadata": {},
259+
"source": [
260+
"So far we have created prompts that are called zero-shot prompts. Basically it means that these prompts have no specific examples, we just tell it to do what we want.\n",
261+
"\n",
262+
"Next we will be working with one-shot prompts. In addition to describing what you want like in zero-shot prompts, one-shot prompts are prompts adds the prompt with a single example. This helps generate a more context-aware response."
263+
]
264+
},
249265
{
250266
"cell_type": "code",
251267
"execution_count": null,
@@ -412,6 +428,13 @@
412428
"6947/19"
413429
]
414430
},
431+
{
432+
"cell_type": "markdown",
433+
"metadata": {},
434+
"source": [
435+
"Based on the calculation above, the column's normalization factor is 365. So let's transform the existing age column by dividing it by 365 and create a new column and dataframe."
436+
]
437+
},
415438
{
416439
"cell_type": "code",
417440
"execution_count": null,
@@ -421,6 +444,13 @@
421444
"# create a new dataframe, create a new column 'diagnoses.age_at_diagnosis_years' by dividing 'diagnoses.age_at_diagnosis' by 365, and drop the 'diagonses.age_at_diagnosis' column"
422445
]
423446
},
447+
{
448+
"cell_type": "markdown",
449+
"metadata": {},
450+
"source": [
451+
"The publication “High-Throughput Genomic Profiling of Adult Solid Tumors Reveals Novel Insights into Cancer Pathogenesis”, http://cancerres.aacrjournals.org/content/77/9/2464.long, removes records of patients aged 89 or older. Let's do some data cleaning to reflect this."
452+
]
453+
},
424454
{
425455
"cell_type": "code",
426456
"execution_count": null,
@@ -439,6 +469,13 @@
439469
"# drop the record with 'diagnosis.age_at_diagnosis_years' greater or equal to 89"
440470
]
441471
},
472+
{
473+
"cell_type": "markdown",
474+
"metadata": {},
475+
"source": [
476+
"Currently, the age column stores the ages of the participants as floats. The publication however describes and visualizes the result of the age distribution as integers. Given that information, let's do more data transformation to reflect this."
477+
]
478+
},
442479
{
443480
"cell_type": "code",
444481
"execution_count": null,

0 commit comments

Comments
 (0)