You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/polars.md
-239Lines changed: 0 additions & 239 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -592,243 +592,4 @@ Note that polars offers many other file type alternatives.
592
592
593
593
Polars has [a wide variety](https://docs.pola.rs/user-guide/io/) of methods that we can use to read excel, json, parquet or plug straight into a database server.
594
594
595
-
## Exercises
596
-
597
-
```{exercise-start}
598
-
:label: pl_ex1
599
-
```
600
-
601
-
With these imports:
602
-
603
-
```{code-cell} ipython3
604
-
import datetime as dt
605
-
import yfinance as yf
606
-
```
607
-
608
-
Write a program to calculate the percentage price change over 2021 for the following shares:
609
-
610
-
```{code-cell} ipython3
611
-
ticker_list = {'INTC': 'Intel',
612
-
'MSFT': 'Microsoft',
613
-
'IBM': 'IBM',
614
-
'BHP': 'BHP',
615
-
'TM': 'Toyota',
616
-
'AAPL': 'Apple',
617
-
'AMZN': 'Amazon',
618
-
'C': 'Citigroup',
619
-
'QCOM': 'Qualcomm',
620
-
'KO': 'Coca-Cola',
621
-
'GOOG': 'Google'}
622
-
```
623
-
624
-
Here's the first part of the program
625
-
626
-
```{note}
627
-
Many python packages will return Pandas DataFrames by default. In this example we use the `yfinance` package and convert the data to a polars DataFrame
628
-
```
629
-
630
-
```{code-cell} ipython3
631
-
def read_data(ticker_list,
632
-
start=dt.datetime(2021, 1, 1),
633
-
end=dt.datetime(2021, 12, 31)):
634
-
"""
635
-
This function reads in closing price data from Yahoo
0 commit comments