Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a2a3763

Browse filesBrowse files
jstacmmcky
andauthored
Edits to about Python lecture (#365)
* misc * misc * spell check --------- Co-authored-by: mmcky <mamckay@gmail.com>
1 parent 520e7e2 commit a2a3763
Copy full SHA for a2a3763

File tree

Expand file treeCollapse file tree

4 files changed

+82
-105
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+82
-105
lines changed
Open diff view settings
Collapse file
2.8 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎lectures/about_py.md‎

Copy file name to clipboardExpand all lines: lectures/about_py.md
+47-65Lines changed: 47 additions & 65 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,58 @@ into R." -- Chris Wiggins
3434
This lecture series will teach you to use Python for scientific computing, with
3535
a focus on economics and finance.
3636

37-
The series is aimed at Python novices, although experienced users will also find useful content in later lectures.
37+
The series is aimed at Python novices, although experienced users will also find
38+
useful content in later lectures.
3839

3940
In this lecture we will
4041

4142
* introduce Python,
4243
* showcase some of its abilities,
43-
* discuss the connection between Python and AI,
4444
* explain why Python is our favorite language for scientific computing, and
4545
* point you to the next steps.
4646

4747
You do **not** need to understand everything you see in this lecture -- we will work through the details slowly later in the lecture series.
4848

4949

50-
### Can't I Just Use ChatGPT?
50+
### Can't I Just Use LLMs?
5151

5252
No!
5353

54-
It's tempting to think that in the age of AI we don't need to learn how to code.
54+
Of course it's tempting to think that in the age of AI we don't need to learn how to code.
5555

56-
And it's true that AIs like [ChatGPT](https://chatgpt.com/) and other LLMs are wonderful productivity tools for coders.
56+
And yes, we like to be lazy too sometimes.
5757

58-
In fact an AI can be a great companion for these lectures -- try copy-pasting some code from this series and ask the AI to explain it to you.
58+
In addition, we agree that AIs are outstanding productivity tools for coders.
5959

60-
AIs will certainly help you write pieces of code that you can combine.
60+
But AIs cannot reliably solve new problems that they haven't seen before.
6161

62-
But AIs cannot completely and reliably solve a new problem that they haven't seen before!
62+
You will need to be the architect and the supervisor -- and for these tasks you need to
63+
be able to read, write, and understand computer code.
6364

64-
You will need to be the supervisor -- and for that you need to be able to read, write, and understand computer code.
65+
Having said that, a good LLM is a useful companion for these lectures -- try copy-pasting some
66+
code from this series and asking for an explanation.
6567

6668

6769
### Isn't MATLAB Better?
6870

6971
No, no, and one hundred times no.
7072

71-
For almost all modern problems, Python's scientific libraries are now far in advance of MATLAB's capabilities.
73+
Nirvana was great (and Soundgarden [was better](https://www.youtube.com/watch?v=3mbBbFH9fAg&list=RD3mbBbFH9fAg)) but
74+
it's time to move on from the '90s.
7275

73-
We will explain the benefits of Python's libraries throughout this lecture
74-
series, as well as in our later series on [JAX](https://jax.quantecon.org/intro.html).
76+
For most modern problems, Python's scientific libraries are now far in advance of MATLAB's capabilities.
77+
78+
This is particularly the case in fast-growing fields such as deep learning and reinforcement learning.
7579

76-
We will also explain how Python's elegant design helps you write clean, efficient code.
80+
Moreover, all major LLMs are more proficient at writing Python code than MATLAB
81+
code.
7782

78-
On top of these features, Python is more widely used, with a huge and helpful community, and free!
83+
We will discuss relative merits of Python's libraries throughout this lecture
84+
series, as well as in our later series on [JAX](https://jax.quantecon.org/intro.html).
7985

8086

81-
## What's Python?
8287

88+
## Introducing Python
8389

8490
[Python](https://www.python.org) is a general-purpose programming language conceived in 1989 by [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum).
8591

@@ -92,13 +98,13 @@ This is important because it
9298
* encourages reproducibility and [open science](https://en.wikipedia.org/wiki/Open_science).
9399

94100

95-
96101
### Common Uses
97102

98-
{index}`Python <single: Python; common uses>` is a general-purpose language used in almost all application domains, including
103+
{index}`Python <single: Python; common uses>` is a general-purpose language used
104+
in almost all application domains, including
99105

100-
* AI
101-
* scientific computing
106+
* AI and computer science
107+
* other scientific computing
102108
* communication
103109
* web development
104110
* CGI and graphical user interfaces
@@ -107,67 +113,55 @@ This is important because it
107113
* multimedia
108114
* etc.
109115

110-
It is used and supported extensively by tech firms including
116+
It is used and supported extensively by large tech firms including
111117

112118
* [Google](https://www.google.com/)
113119
* [OpenAI](https://openai.com/)
114120
* [Netflix](https://www.netflix.com/)
115121
* [Meta](https://opensource.fb.com/)
116-
* [Dropbox](https://www.dropbox.com/)
117122
* [Amazon](https://www.amazon.com/)
118123
* [Reddit](https://www.reddit.com/)
119124
* etc.
120125

121126

122-
123-
124127
### Relative Popularity
125128

126-
Python is, without doubt, one of the [most popular programming languages](https://www.tiobe.com/tiobe-index/).
129+
Python is one of the most -- if not the most -- [popular programming languages](https://www.tiobe.com/tiobe-index/).
127130

128131
Python libraries like [pandas](https://pandas.pydata.org/) and [Polars](https://pola.rs/) are replacing familiar tools like Excel and VBA as an essential skill in the fields of finance and banking.
129132

130-
Moreover, Python is extremely popular within the scientific community -- especially AI
131-
132-
The following chart, produced using Stack Overflow Trends, provides some evidence.
133+
Moreover, Python is extremely popular within the scientific community -- especially those connected to AI
133134

134-
It shows the popularity of a Python AI library called [PyTorch](https://pytorch.org/) relative to MATLAB.
135+
For example, the following chart from Stack Overflow Trends shows how the
136+
popularity of a single Python deep learning library
137+
([PyTorch](https://pytorch.org/)) has grown over the last few years.
135138

136139

137140
```{figure} /_static/lecture_specific/about_py/pytorch_vs_matlab.png
138141
```
142+
Pytorch is just one of several Python libraries for deep learning and AI.
139143

140-
The chart shows that MATLAB's popularity has faded, while PyTorch is growing rapidly.
141-
142-
Moreover, PyTorch is just one of the thousands of Python libraries available for scientic computing.
143144

144145

145146
### Features
146147

147-
Python is a [high-level language](https://en.wikipedia.org/wiki/High-level_programming_language), which means it is relatively easy to read, write and debug.
148+
Python is a [high-level
149+
language](https://en.wikipedia.org/wiki/High-level_programming_language), which
150+
means it is relatively easy to read, write and debug.
148151

149152
It has a relatively small core language that is easy to learn.
150153

151-
This core is supported by many libraries, which you can learn to use as required.
152-
153-
Python is very beginner-friendly
154-
155-
* suitable for students learning programming
156-
* used in many undergraduate and graduate programs
157-
158-
Other features of Python:
159-
160-
* multiple programming styles are supported (procedural, object-oriented, functional, etc.)
161-
* [interpreted](https://en.wikipedia.org/wiki/Interpreter_(computing)) rather than [compiled](https://en.wikipedia.org/wiki/Compiler) ahead of time.
154+
This core is supported by many libraries, which can be studied as required.
162155

156+
Python is flexible and pragmatic, supporting multiple programming styles (procedural, object-oriented, functional, etc.).
163157

164158

165159
### Syntax and Design
166160

167161
```{index} single: Python; syntax and design
168162
```
169163

170-
One reason for Python's popularity is its simple and elegant design --- we'll see many examples later on.
164+
One reason for Python's popularity is its simple and elegant design.
171165

172166
To get a feeling for this, let's look at an example.
173167

@@ -231,12 +225,9 @@ public class CSVReader {
231225
This Java code opens an imaginary file called `data.csv` and computes the mean
232226
of the values in the second column.
233227

234-
Even without knowing Java, you can see that the program is long and complex.
235-
236228
Here's Python code that does the same thing.
237229

238-
Even if you don't yet know Python, you can see that the code is simpler and
239-
easier to read.
230+
Even if you don't yet know Python, you can see that the code is far simpler and easier to read.
240231

241232
```{code-cell} python3
242233
:tags: [skip-execution]
@@ -256,20 +247,14 @@ print(f"Average: {total / count if count else 'No valid data'}")
256247
257248
```
258249

259-
The simplicity of Python and its neat design are a big factor in its popularity.
260250

261251

262252
### The AI Connection
263253

264-
Unless you have been living under a rock and avoiding all contact with the
265-
modern world, you will know that AI is rapidly advancing.
266-
267-
AI is already remarkably good at helping you write code, as discussed above.
268-
269-
No doubt AI will take over many tasks currently performed by humans,
270-
just like other forms of machinery have done over the past few centuries.
254+
AI is in the process of taking over many tasks currently performed by humans,
255+
just as other forms of machinery have done over the past few centuries.
271256

272-
Python is playing a huge role in the advance of AI and machine learning.
257+
Moreover, Python is playing a huge role in the advance of AI and machine learning.
273258

274259
This means that tech firms are pouring money into development of extremely
275260
powerful Python libraries.
@@ -288,9 +273,7 @@ These lectures will explain how.
288273

289274
We have already discussed the importance of Python for AI, machine learning and data science
290275

291-
Let's take a look at the role of Python in other areas of scientific computing.
292-
293-
Python is either the dominant player or a major player in
276+
Python is also one of the dominant players in
294277

295278
* astronomy
296279
* chemistry
@@ -305,7 +288,6 @@ operations research -- which were previously dominated by MATLAB / Excel / STATA
305288
This section briefly showcases some examples of Python for general scientific programming.
306289

307290

308-
309291
### NumPy
310292

311293
```{index} single: scientific programming; numeric
@@ -379,6 +361,8 @@ However, you should still learn NumPy first because
379361
* libraries like JAX directly extend NumPy functionality and hence are easier to
380362
learn when you already know NumPy.
381363

364+
This lecture series will provide you with extensive background in NumPy.
365+
382366
### SciPy
383367

384368
The [SciPy](http://www.scipy.org) library is built on top of NumPy and provides additional functionality.
@@ -453,7 +437,7 @@ You can visit the [Python Graph Gallery](https://www.python-graph-gallery.com/)
453437

454438
### Networks and Graphs
455439

456-
The study of networks and graphs becoming an important part of scientific work
440+
The study of [networks](https://networks.quantecon.org/) is becoming an important part of scientific work
457441
in economics, finance and other fields.
458442

459443
For example, we are interesting in studying
@@ -463,8 +447,6 @@ For example, we are interesting in studying
463447
* friendship and social networks
464448
* etc.
465449

466-
(We have a [book on economic networks](https://networks.quantecon.org/) if you would like to learn more.)
467-
468450
Python has many libraries for studying networks and graphs.
469451

470452
```{index} single: NetworkX
@@ -530,7 +512,7 @@ mentioned above.
530512
* [Dask](https://docs.dask.org/en/stable/) for parallelization
531513
* [Numba](http://numba.pydata.org/) for making Python run at the same speed as native machine code
532514
* [CVXPY](https://www.cvxpy.org/) for convex optimization
533-
* [scikit-image](https://scikit-image.org/) and [OpenCV](https://opencv.org/) for processing and analysing image data
515+
* [scikit-image](https://scikit-image.org/) and [OpenCV](https://opencv.org/) for processing and analyzing image data
534516
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) for extracting data from HTML and XML files
535517

536518

Collapse file

‎lectures/intro.md‎

Copy file name to clipboardExpand all lines: lectures/intro.md
+3-4Lines changed: 3 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ kernelspec:
1111

1212
# Python Programming for Economics and Finance
1313

14-
This website presents a set of lectures on Python programming for economics and finance.
14+
These lectures are the first in [the set of lecture series](https://quantecon.org/lectures/) provided by QuantEcon.
1515

16-
This is the first text in the series, which focuses on programming in Python.
17-
18-
For an overview of the series, see [this page](https://quantecon.org/lectures/)
16+
They focus on learning to program in Python, with a view to applications in
17+
economics and finance.
1918

2019
```{tableofcontents}
2120
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.