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

CON-2307update subejct and audit examples to be coherent with task #2315

Merged
merged 1 commit into from
Nov 27, 2023
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
18 changes: 11 additions & 7 deletions subjects/ai/time-series/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,19 @@ market_data = pd.DataFrame(index=index,

1. **Without using a for loop**, compute the daily returns (return(d) = (price(d)-price(d-1))/price(d-1)) for all the companies and returns a DataFrame as:

| Date | ('Price', 'AAPL') | ('Price', 'AMZN') | ('Price', 'DAI') | ('Price', 'FB') | ('Price', 'GE') |
| :------------------ | ----------------: | ----------------: | ---------------: | --------------: | --------------: |
| 2021-01-01 00:00:00 | nan | nan | nan | nan | nan |
| 2021-01-04 00:00:00 | 1.01793 | 0.0512955 | 3.84709 | -0.503488 | 0.33529 |
| 2021-01-05 00:00:00 | -0.222884 | -1.64623 | -0.71817 | -5.5036 | -4.15882 |
```console
Ticker AAPL AMZN DAI FB GE
Date
2021-01-01 NaN NaN NaN NaN NaN
2021-01-04 -2.668008 -4.716002 -1.885721 0.496173 1.862998
2021-01-05 -2.194111 -2.747143 -0.165338 0.318410 0.085519
2021-01-06 -1.164307 -1.194895 -2.595224 -0.219974 -0.805512
2021-01-07 3.428472 3.778445 -0.956788 -1.538637 0.108276
```

Note: The data is generated randomly, the values you may have a different results. But, this shows the expected DataFrame structure.
Note: The data is generated randomly, the values you may have lead to a different result. The above example shows the expected DataFrame structure.

`Hint use groupby`
`Hint use pivot_table`

---

Expand Down
2 changes: 1 addition & 1 deletion subjects/ai/time-series/audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The first way to do it is to compute the return without for loop is to use `pct_
###### Is the outputted DataFrame's shape `(261, 5)` without having used a for loop and the is the output the same as the one returned with this line of code? The DataFrame contains random data. Make sure the output and the one returned by this code is based on the same DataFrame.

```python
market_data.loc[market_data.index.get_level_values('Ticker')=='AAPL'].sort_index().pct_change()
market_data.pivot_table(values="Price", index="Date", columns="Ticker").pct_change()
```

---
Expand Down
Loading