Skip to content

Commit c364548

Browse files
authored
Merge pull request #187 from QuantEcon/lec-review-1
Chapter 1 Review: update hyperlinks and outdated packages
2 parents f1be450 + c99e8ee commit c364548

1 file changed

Lines changed: 100 additions & 55 deletions

File tree

lectures/about_py.md

Lines changed: 100 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ into R." -- Chris Wiggins
3838
In this lecture we will
3939

4040
* outline what Python is
41-
* showcase some of its abilities
42-
* compare it to some other languages.
41+
* compare it to some other languages
42+
* showcase some of its abilities.
4343

4444
At this stage, it's **not** our intention that you try to replicate all you see.
4545

@@ -63,21 +63,28 @@ Python has experienced rapid adoption in the last decade and is now one of the m
6363
* web development
6464
* CGI and graphical user interfaces
6565
* game development
66-
* multimedia, data processing, security, etc., etc., etc.
66+
* resource planning
67+
* multimedia, data science, security, etc., etc., etc.
6768

68-
Used extensively by Internet services and high tech companies including
69+
Used and supported extensively by Internet services and high-tech companies including
6970

7071
* [Google](https://www.google.com/)
72+
* [Netflix](https://www.netflix.com/)
73+
* [Meta](https://opensource.fb.com/)
7174
* [Dropbox](https://www.dropbox.com/)
75+
* [Amazon](https://www.amazon.com/)
7276
* [Reddit](https://www.reddit.com/)
73-
* [YouTube](https://www.youtube.com/)
74-
* [Walt Disney Animation](https://pydanny-event-notes.readthedocs.org/en/latest/socalpiggies/20110526-wda.html).
7577

76-
Python is very beginner-friendly and is often used to [teach computer science and programming](http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-us-universities/fulltext).
78+
For reasons we will discuss, Python is particularly popular within the scientific community and behind many scientific achievements in
79+
* [Space Science](https://code.nasa.gov/?q=python)
80+
* [Particle Physics](https://home.cern/news/news/physics/speeding-machine-learning-particle-physics)
81+
* [Genetics](https://github.com/deepmind/alphafold)
7782

78-
For reasons we will discuss, Python is particularly popular within the scientific community with users including NASA, CERN and practically all branches of academia.
83+
and practically all branches of academia.
7984

80-
It is also [replacing familiar tools like Excel](https://news.efinancialcareers.com/us-en/3002556/python-replaced-excel-banking) in the fields of finance and banking.
85+
Meanwhile, Python is also very beginner-friendly and is found to be suitable for students learning programming and recommended to introduce computational methods to students in [fields other than computer science](https://www.sciencedirect.com/science/article/pii/S1477388021000177).
86+
87+
Python is also [replacing familiar tools like Excel as an essential skill](https://www.efinancialcareers.com.au/news/2021/08/python-for-banking-jobs) in the fields of finance and banking.
8188

8289
### Relative Popularity
8390

@@ -103,7 +110,7 @@ Python's popularity begin to spike in the first figure.
103110

104111
Overall, it's clear that
105112

106-
* Python is [one of the most popular programming languages worldwide](https://spectrum.ieee.org/computing/software/the-top-programming-languages-2019).
113+
* Python is [one of the most popular programming languages worldwide](https://spectrum.ieee.org/top-programming-languages-2021).
107114
* Python is a major tool for scientific computing, accounting for a rapidly rising share of scientific work around the globe.
108115

109116
### Features
@@ -143,18 +150,18 @@ Python has become one of the core languages of scientific computing.
143150

144151
It's either the dominant player or a major player in
145152

146-
* [machine learning and data science](http://scikit-learn.org/stable/)
153+
* [machine learning and data science](https://github.com/ml-tooling/best-of-ml-python)
147154
* [astronomy](http://www.astropy.org/)
148-
* [artificial intelligence](https://wiki.python.org/moin/PythonForArtificialIntelligence)
149155
* [chemistry](http://chemlab.github.io/chemlab/)
150156
* [computational biology](http://biopython.org/wiki/Main_Page)
151157
* [meteorology](https://pypi.org/project/meteorology/)
158+
* [natural language processing](https://www.nltk.org/)
152159

153160
Its popularity in economics is also beginning to rise.
154161

155162
This section briefly showcases some examples of Python for scientific programming.
156163

157-
* All of these topics will be covered in detail later on.
164+
* All of these topics below will be covered in detail later on.
158165

159166
### Numerical Programming
160167

@@ -205,7 +212,7 @@ SciPy includes many of the standard routines used in
205212
* [integration](http://docs.scipy.org/doc/scipy/reference/integrate.html)
206213
* [interpolation](http://docs.scipy.org/doc/scipy/reference/interpolate.html)
207214
* [optimization](http://docs.scipy.org/doc/scipy/reference/optimize.html)
208-
* [distributions and random number generation](http://docs.scipy.org/doc/scipy/reference/stats.html)
215+
* [distributions and statistical techniques](http://docs.scipy.org/doc/scipy/reference/stats.html)
209216
* [signal processing](http://docs.scipy.org/doc/scipy/reference/signal.html)
210217

211218
See them all [here](http://docs.scipy.org/doc/scipy/reference/index.html).
@@ -238,13 +245,15 @@ Example 3D plot
238245
```{figure} /_static/lecture_specific/about_py/career_vf.png
239246
```
240247

241-
More examples can be found in the [Matplotlib thumbnail gallery](http://matplotlib.org/gallery.html).
248+
More examples can be found in the [Matplotlib thumbnail gallery](https://matplotlib.org/stable/gallery/index.html).
242249

243250
Other graphics libraries include
244251

245252
* [Plotly](https://plot.ly/python/)
253+
* [seaborn](https://seaborn.pydata.org/) --- a high-level interface for matplotlib
246254
* [Bokeh](http://bokeh.pydata.org/en/latest/)
247-
* [VPython](http://www.vpython.org/) --- 3D graphics and animations
255+
256+
You can visit the [Python Graph Gallery](https://www.python-graph-gallery.com/) for more example plots drawn using a variety of libraries.
248257

249258
### Symbolic Algebra
250259

@@ -280,7 +289,7 @@ solve(x**2 + x + 2)
280289
and calculate limits, derivatives and integrals
281290

282291
```{code-cell} python3
283-
from sympy import limit, sin, diff
292+
from sympy import limit, sin, diff, integrate
284293
285294
limit(1 / x, x, 0)
286295
```
@@ -293,16 +302,19 @@ limit(sin(x) / x, x, 0)
293302
diff(sin(x), x)
294303
```
295304

296-
The beauty of importing this functionality into Python is that we are working within
297-
a fully fledged programming language.
305+
```{code-cell} python3
306+
integrate(sin(x) * x, x)
307+
```
308+
309+
The beauty of importing this functionality into Python is that we are working within a fully fledged programming language.
298310

299-
We can easily create tables of derivatives, generate LaTeX output, add that output
300-
to figures and so on.
311+
We can easily create tables of derivatives, generate LaTeX output, add that output to figures and so on.
301312

302313
### Statistics
303314

304315
Python's data manipulation and statistics libraries have improved rapidly over
305-
the last few years.
316+
the last few years to tackle
317+
[specific problems in data science](https://ieeexplore.ieee.org/document/8757088).
306318

307319
#### Pandas
308320

@@ -321,7 +333,7 @@ import pandas as pd
321333
np.random.seed(1234)
322334
323335
data = np.random.randn(5, 2) # 5x2 matrix of N(0, 1) random draws
324-
dates = pd.date_range('28/12/2010', periods=5)
336+
dates = pd.date_range('2010-12-28', periods=5)
325337
326338
df = pd.DataFrame(data, columns=('price', 'weight'), index=dates)
327339
print(df)
@@ -331,7 +343,8 @@ print(df)
331343
df.mean()
332344
```
333345

334-
#### Other Useful Statistics Libraries
346+
347+
#### Other Useful Statistics and Data Science Libraries
335348

336349
```{index} single: statsmodels
337350
```
@@ -341,17 +354,28 @@ df.mean()
341354
```{index} single: scikit-learn
342355
```
343356

344-
* [scikit-learn](http://scikit-learn.org/) --- machine learning in Python (sponsored by Google, among others)
357+
* [scikit-learn](http://scikit-learn.org/) --- Machine Learning in Python
345358

346-
```{index} single: pyMC
359+
```{index} single: PyTorch
347360
```
348361

349-
* [pyMC](http://pymc-devs.github.io/pymc/) --- for Bayesian data analysis
362+
* [PyTorch](https://pytorch.org/) --- Deep learning framework in Python and other major competitors in the field including [TensorFlow](https://www.tensorflow.org/overview) and [Keras](https://keras.io/)
350363

351-
```{index} single: pystan
364+
```{index} single: Pyro
352365
```
353366

354-
* [pystan](https://pystan.readthedocs.org/en/latest/) Bayesian analysis based on [stan](http://mc-stan.org/)
367+
* [Pyro](https://pyro.ai/) and [PyStan](https://pystan.readthedocs.org/en/latest/) --- for Bayesian data analysis building on [Pytorch](https://pytorch.org/) and [stan](http://mc-stan.org/) respectively
368+
369+
```{index} single: lifelines
370+
```
371+
372+
* [lifelines](https://lifelines.readthedocs.io/en/latest/) --- for survival analysis
373+
374+
```{index} single: GeoPandas
375+
```
376+
377+
* [GeoPandas](https://geopandas.org/en/stable/) --- for spatial data analysis
378+
355379

356380
### Networks and Graphs
357381

@@ -366,7 +390,7 @@ Its features include, among many other things:
366390
* standard graph algorithms for analyzing networks
367391
* plotting routines
368392

369-
Here's some example code that generates and plots a random graph, with node color determined by shortest path length from a central node.
393+
Here's some example code that generates and plots a random graph, with node color determined by the shortest path length from a central node.
370394

371395
```{code-cell} ipython
372396
%matplotlib inline
@@ -405,32 +429,33 @@ plt.show()
405429

406430
Running your Python code on massive servers in the cloud is becoming easier and easier.
407431

408-
```{index} single: cloud computing; anaconda enterprise
432+
```{index} single: cloud computing; google colab
409433
```
410434

411-
A nice example is [Anaconda Enterprise](https://www.anaconda.com/enterprise/).
435+
An excellent example of the portability of python in a cloud computing environment is [Google Colab](https://colab.research.google.com/). It hosts the Jupyter notebook on cloud servers with no pre-configuration necessary to run Python code using cloud servers.
412436

413-
See also
414437

415-
```{index} single: cloud computing; amazon ec2
416-
```
438+
There are also commercial applications of cloud computing using Python:
417439

418-
* [Amazon Elastic Compute Cloud](http://aws.amazon.com/ec2/)
440+
```{index} single: cloud computing; anaconda enterprise
441+
```
442+
* [Anaconda Enterprise](https://www.anaconda.com/enterprise/)
419443

420-
```{index} single: cloud computing; google app engine
444+
```{index} single: cloud computing; AWS
421445
```
422446

423-
* The [Google App Engine](https://cloud.google.com/appengine/) (Python, Java, PHP or Go)
447+
* [Amazon Web Services](https://aws.amazon.com/developer/language/python/?nc1=f_dr)
424448

425-
```{index} single: cloud computing; pythonanywhere
449+
```{index} single: cloud computing; Google Cloud
426450
```
427451

428-
* [Pythonanywhere](https://www.pythonanywhere.com/)
452+
* [Google Cloud](https://cloud.google.com/)
429453

430-
```{index} single: cloud computing; sagemath cloud
454+
```{index} single: cloud computing; digital ocean
431455
```
432456

433-
* [Sagemath Cloud](https://cloud.sagemath.com/)
457+
* [Digital Ocean](https://www.digitalocean.com/)
458+
434459

435460
### Parallel Processing
436461

@@ -442,20 +467,21 @@ Apart from the cloud computing options listed above, you might like to consider
442467
```{index} single: parallel computing; ipython
443468
```
444469

445-
* [Parallel computing through IPython clusters](http://ipython.org/ipython-doc/stable/parallel/parallel_demos.html).
446-
447-
```{index} single: parallel computing; starcluster
448-
```
470+
* [Parallel computing through IPython clusters](https://ipyparallel.readthedocs.io/en/latest/).
449471

450-
* The [Starcluster](http://star.mit.edu/cluster/) interface to Amazon's EC2.
451472

452-
```{index} single: parallel computing; copperhead
473+
```{index} single: parallel computing; Dask
453474
```
454475

476+
* [Dask](https://www.dask.org/) parallelises PyData and Machine Learning in Python.
477+
455478
```{index} single: parallel computing; pycuda
456479
```
457480

458-
* GPU programming through [PyCuda](https://wiki.tiker.net/PyCuda), [PyOpenCL](https://mathema.tician.de/software/pyopencl/), [Theano](https://en.wikipedia.org/wiki/Theano_(software)) or similar.
481+
* GPU programming through [JAX](https://jax.readthedocs.io/en/latest/notebooks/quickstart.html), [PyCuda](https://wiki.tiker.net/PyCuda), [PyOpenCL](https://documen.tician.de/pyopencl/), [Rapids](https://rapids.ai/), etc.
482+
483+
484+
Here is more about [recent developments](https://pasc22.pasc-conference.org/program/papers/) in high-performance computing (HPC) in scientific computing and [how HPC helps researchers in different fields](https://pasc22.pasc-conference.org/program/keynote-presentations/).
459485

460486
(intfc)=
461487
### Other Developments
@@ -472,27 +498,46 @@ Some representative examples include
472498
```{index} single: scientific programming; Numba
473499
```
474500

475-
* [Numba](http://numba.pydata.org/) --- Make Python run at the same speed as native machine code!
501+
* [Numba](http://numba.pydata.org/) --- make Python run at the same speed as native machine code!
476502

477-
```{index} single: scientific programming; Blaze
503+
```{index} single: scientific programming; CVXPY
478504
```
479505

480-
* [Blaze](http://blaze.pydata.org/) --- a generalization of NumPy.
506+
* [CVXPY](https://www.cvxpy.org/) --- convex optimization in Python.
507+
481508

482509
```{index} single: scientific programming; PyTables
483510
```
484511

485512
* [PyTables](http://www.pytables.org) --- manage large data sets.
486513

487-
```{index} single: scientific programming; CVXPY
514+
515+
```{index} single: scientific programming; scikit-image
516+
```
517+
518+
* [scikit-image](https://scikit-image.org/) and [OpenCV](https://opencv.org/) --- process and analyse scientific image data.
519+
520+
521+
```{index} single: scientific programming; mlflow
522+
```
523+
524+
* [FLAML](https://mlflow.org/docs/latest/index.html) --- automate machine learning and hyperparameter tuning.
525+
526+
527+
```{index} single: scientific programming; BeautifulSoup
528+
```
529+
530+
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) --- extract data from HTML and XML files.
531+
532+
```{index} single: scientific programming; PyInstaller
488533
```
489534

490-
* [CVXPY](https://github.com/cvxgrp/cvxpy) --- convex optimization in Python.
535+
* [PyInstaller](https://pyinstaller.org/en/stable/) --- create packaged app from python script.
491536

492537
## Learn More
493538

494539
* Browse some Python projects on [GitHub](https://github.com/trending?l=python).
495-
* Read more about [Python's history and rise in popularity](https://www.welcometothejungle.com/en/articles/btc-python-popular) .
540+
* Read more about [Python's history and rise in popularity](https://www.welcometothejungle.com/en/articles/btc-python-popular) and [version history](https://www.python.org/doc/versions/).
496541
* Have a look at [some of the Jupyter notebooks](http://nbviewer.jupyter.org/) people have shared on various scientific topics.
497542

498543
```{index} single: Python; PyPI

0 commit comments

Comments
 (0)