Skip to content

Commit 6056d85

Browse files
committed
Update translation: lectures/polars.md
1 parent 7ef45fd commit 6056d85

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

lectures/polars.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ df
174174
این را با `pl.read_csv` می‌خوانیم
175175

176176
```{code-cell} ipython3
177-
url = ('https://raw.githubusercontent.com/QuantEcon/'
178-
'lecture-python-programming/main/lectures/_static/'
179-
'lecture_specific/pandas/data/test_pwt.csv')
177+
url = 'https://github.com/QuantEcon/data-lectures/raw/main/lectures/test_pwt.csv'
180178
df = pl.read_csv(url)
181179
df
182180
```
@@ -360,9 +358,7 @@ plt.show()
360358

361359
```{code-cell} ipython3
362360
# Reload the dataset
363-
url = ('https://raw.githubusercontent.com/QuantEcon/'
364-
'lecture-python-programming/main/lectures/_static/'
365-
'lecture_specific/pandas/data/test_pwt.csv')
361+
url = 'https://github.com/QuantEcon/data-lectures/raw/main/lectures/test_pwt.csv'
366362
df_full = pl.read_csv(url)
367363
```
368364

@@ -438,9 +434,7 @@ import pandas as pd
438434
import time
439435
440436
# Small dataset -- Penn World Tables (~8 rows)
441-
url = ('https://raw.githubusercontent.com/QuantEcon/'
442-
'lecture-python-programming/main/lectures/_static/'
443-
'lecture_specific/pandas/data/test_pwt.csv')
437+
url = 'https://github.com/QuantEcon/data-lectures/raw/main/lectures/test_pwt.csv'
444438
small_pd = pd.read_csv(url)
445439
small_pl = pl.read_csv(url)
446440
```
@@ -480,13 +474,13 @@ print(f"Small data -- pandas: {pd_small:.4f}s | Polars eager: {pl_small:.4f}s"
480474

481475
```{code-cell} ipython3
482476
n = 5_000_000
483-
np.random.seed(42)
477+
rng = np.random.default_rng(42)
484478
485-
groups = np.random.choice(['A', 'B', 'C', 'D'], n)
486-
values = np.random.randn(n)
487-
weights = np.random.rand(n)
488-
extra1 = np.random.randn(n)
489-
extra2 = np.random.randn(n)
479+
groups = rng.choice(['A', 'B', 'C', 'D'], n)
480+
values = rng.standard_normal(n)
481+
weights = rng.random(n)
482+
extra1 = rng.standard_normal(n)
483+
extra2 = rng.standard_normal(n)
490484
491485
big_pd = pd.DataFrame({
492486
'group': groups, 'value': values,
@@ -821,4 +815,4 @@ plt.show()
821815
```
822816

823817
```{solution-end}
824-
```
818+
```

0 commit comments

Comments
 (0)