Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images #14

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions 02-data-structures.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,25 @@ Perhaps the most important operation you will can do with Dataframes is subsetti

You will use the `iloc` and bracket operations, and you give two slices: one for the row, and one for the column.

Let's start with a small dataframe to see how it works before returning to `metadata`:

```{python}
df = pd.DataFrame(data={'status': ["treated", "untreated", "untreated", "discharged", "treated"],
'age_case': [25, 43, 21, 65, 7],
'age_control': [49, 20, 32, 25, 32]})
df
```

Here is how the dataframe looks like with the row and column index numbers:

![](images/pandas_subset_0.png)

Subset the second to fourth rows, and the first two columns:

![](images/pandas_subset_1.png)

Now, back to `metadata` dataframe.

Subset the first 5 rows, and first two columns:

```{python}
Expand Down
9 changes: 9 additions & 0 deletions 03-data-wrangling1.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```{r, include = FALSE}
ottrpal::set_knitr_image_path()
```

# Data Wrangling

## Exercises

Exercise for week 3 can be found [here](#)
1 change: 1 addition & 0 deletions _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repo: https://github.com/jhudsl/OTTR_Template/
rmd_files: ["index.Rmd",
"01-intro-to-computing.Rmd",
"02-data-structures.Rmd",
"03-data-wrangling1.Rmd",
"About.Rmd",
"References.Rmd"]
new_session: yes
Expand Down
Binary file added images/pandas_subset_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/pandas_subset_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading