diff --git a/lectures/about_py.md b/lectures/about_py.md index 4f9c883c..fdd22c7f 100644 --- a/lectures/about_py.md +++ b/lectures/about_py.md @@ -89,7 +89,7 @@ series, as well as in our later series on [JAX](https://jax.quantecon.org/intro. [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). -Python is free and [open source](https://en.wikipedia.org/wiki/Open_source), with development coordinated through the [Python Software Foundation](https://www.python.org/psf/). +Python is free and [open source](https://en.wikipedia.org/wiki/Open_source), with development coordinated through the [Python Software Foundation](https://www.python.org/psf-landing/). This is important because it @@ -349,7 +349,7 @@ We will discuss the details later in the lecture series, where we cover NumPy in While NumPy is still the king of array processing in Python, there are now important competitors. -Libraries such as [JAX](https://github.com/google/jax), [Pytorch](https://pytorch.org/), and [CuPy](https://cupy.dev/) also have +Libraries such as [JAX](https://github.com/jax-ml/jax), [Pytorch](https://pytorch.org/), and [CuPy](https://cupy.dev/) also have built in array types and array operations that can be very fast and efficient. In fact these libraries are better at exploiting parallelization and fast hardware, as @@ -430,9 +430,9 @@ Other graphics libraries include * [Plotly](https://plotly.com/python/) * [seaborn](https://seaborn.pydata.org/) --- a high-level interface for matplotlib * [Altair](https://altair-viz.github.io/) -* [Bokeh](https://bokeh.pydata.org/en/latest/) +* [Bokeh](https://docs.bokeh.org/en/latest/) -You can visit the [Python Graph Gallery](https://www.python-graph-gallery.com/) for more example plots drawn using a variety of libraries. +You can visit the [Python Graph Gallery](https://python-graph-gallery.com/) for more example plots drawn using a variety of libraries. ### Networks and Graphs diff --git a/lectures/getting_started.md b/lectures/getting_started.md index e6c19685..62a5c53c 100644 --- a/lectures/getting_started.md +++ b/lectures/getting_started.md @@ -107,7 +107,7 @@ Anaconda also comes with a package management system to organize your code libra ```{index} single: Python; Anaconda ``` -To install Anaconda, [download](https://www.anaconda.com/download/) the binary and follow the instructions. +To install Anaconda, [download](https://www.anaconda.com/download) the binary and follow the instructions. Important points: @@ -410,7 +410,7 @@ You can explore more functionality of the debugger in the [Jupyter documentation Notebook files are just text files structured in [JSON](https://en.wikipedia.org/wiki/JSON) and typically ending with `.ipynb`. -You can share them in the usual way that you share files --- or by using web services such as [nbviewer](https://nbviewer.jupyter.org/). +You can share them in the usual way that you share files --- or by using web services such as [nbviewer](https://nbviewer.org/). The notebooks you see on that site are **static** html representations. @@ -424,7 +424,7 @@ If you are interested in sharing notebooks containing interactive content, you m To collaborate with other people on notebooks, you might want to take a look at - [Google Colab](https://colab.research.google.com/) -- [Kaggle](https://www.kaggle.com/kernels) +- [Kaggle](https://www.kaggle.com/code) To keep the code private and to use the familiar JupyterLab and Notebook interface, look into the [JupyterLab Real-Time Collaboration extension](https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/). ``` @@ -447,10 +447,10 @@ Most of the libraries we need come in Anaconda. Other libraries can be installed with `pip` or `conda`. -One library we'll be using is [QuantEcon.py](http://quantecon.org/quantecon-py). +One library we'll be using is [QuantEcon.py](https://quantecon.org/quantecon-py/). (gs_install_qe)= -You can install [QuantEcon.py](http://quantecon.org/quantecon-py) by +You can install [QuantEcon.py](https://quantecon.org/quantecon-py/) by starting Jupyter and typing ```{code-block} ipython3 @@ -469,7 +469,7 @@ Alternatively, you can type the following into a terminal conda install quantecon ``` -More instructions can be found on the [library page](http://quantecon.org/quantecon-py). +More instructions can be found on the [library page](https://quantecon.org/quantecon-py/). To upgrade to the latest version, which you should do regularly, use diff --git a/lectures/jax_intro.md b/lectures/jax_intro.md index 1c0d817e..b2cb0577 100644 --- a/lectures/jax_intro.md +++ b/lectures/jax_intro.md @@ -21,7 +21,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie !pip install jax ``` -This lecture provides a short introduction to [Google JAX](https://github.com/google/jax). +This lecture provides a short introduction to [Google JAX](https://github.com/jax-ml/jax). Here we are focused on using JAX on the CPU, rather than on accelerators such as GPUs or TPUs. @@ -620,7 +620,7 @@ x.nbytes # and y is just a pointer to x This extra memory usage can be a big problem in actual research calculations. -So let's try a different approach using [jax.vmap](https://jax.readthedocs.io/en/latest/_autosummary/jax.vmap.html) +So let's try a different approach using [jax.vmap](https://docs.jax.dev/en/latest/_autosummary/jax.vmap.html) +++ diff --git a/lectures/numba.md b/lectures/numba.md index 9580196f..f0018ace 100644 --- a/lectures/numba.md +++ b/lectures/numba.md @@ -166,7 +166,7 @@ This kind of speed gain is impressive relative to how simple and clear the modif ### How and When it Works -Numba attempts to generate fast machine code using the infrastructure provided by the [LLVM Project](http://llvm.org/). +Numba attempts to generate fast machine code using the infrastructure provided by the [LLVM Project](https://llvm.org/). It does this by inferring type information on the fly. @@ -419,7 +419,7 @@ If you prefer, you can safely skip this section. ### Cython -Like {doc}`Numba `, [Cython](http://cython.org/) provides an approach to generating fast compiled code that can be used from Python. +Like {doc}`Numba `, [Cython](https://cython.org/) provides an approach to generating fast compiled code that can be used from Python. As was the case with Numba, a key problem is the fact that Python is dynamically typed. @@ -442,15 +442,15 @@ cumbersome than Numba. ``` If you are comfortable writing Fortran you will find it very easy to create -extension modules from Fortran code using [F2Py](https://docs.scipy.org/doc/numpy/f2py/). +extension modules from Fortran code using [F2Py](https://numpy.org/doc/stable/f2py/). F2Py is a Fortran-to-Python interface generator that is particularly simple to use. -Robert Johansson provides a [nice introduction](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-6A-Fortran-and-C.ipynb) +Robert Johansson provides a [nice introduction](https://nbviewer.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-6A-Fortran-and-C.ipynb) to F2Py, among other things. -Recently, [a Jupyter cell magic for Fortran](http://nbviewer.jupyter.org/github/mgaitan/fortran_magic/blob/master/documentation.ipynb) has been developed --- you might want to give it a try. +Recently, [a Jupyter cell magic for Fortran](https://nbviewer.org/github/mgaitan/fortran_magic/blob/master/documentation.ipynb) has been developed --- you might want to give it a try. ## Summary and Comments @@ -554,7 +554,7 @@ characters. :label: speed_ex2 ``` -In the [Introduction to Quantitative Economics with Python](https://python-intro.quantecon.org) lecture series you can +In the [Introduction to Quantitative Economics with Python](https://intro.quantecon.org/intro.html) lecture series you can learn all about finite-state Markov chains. For now, let's just concentrate on simulating a very simple example of such a chain. diff --git a/lectures/numpy.md b/lectures/numpy.md index 3efbf9fe..84d52a38 100644 --- a/lectures/numpy.md +++ b/lectures/numpy.md @@ -50,7 +50,7 @@ In this lecture, we will start a more systematic discussion of 1. the fundamental array processing operations provided by NumPy. -(For an alternative reference, see [the official NumPy documentation](https://docs.scipy.org/doc/numpy/reference/).) +(For an alternative reference, see [the official NumPy documentation](https://numpy.org/doc/stable/reference/).) We will use the following imports. @@ -72,11 +72,11 @@ from matplotlib import cm The essential problem that NumPy solves is fast array processing. The most important structure that NumPy defines is an array data type, formally -called a [numpy.ndarray](https://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html). +called a [numpy.ndarray](https://numpy.org/doc/stable/reference/arrays.ndarray.html). NumPy arrays power a very large proportion of the scientific Python ecosystem. -To create a NumPy array containing only zeros we use [np.zeros](https://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html#numpy.zeros) +To create a NumPy array containing only zeros we use [np.zeros](https://numpy.org/doc/stable/reference/generated/numpy.zeros.html#numpy.zeros) ```{code-cell} python3 a = np.zeros(3) @@ -90,7 +90,7 @@ type(a) NumPy arrays are somewhat like native Python lists, except that * Data *must be homogeneous* (all elements of the same type). -* These types must be one of the [data types](https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html) (`dtypes`) provided by NumPy. +* These types must be one of the [data types](https://numpy.org/doc/stable/reference/arrays.dtypes.html) (`dtypes`) provided by NumPy. The most important of these dtypes are: @@ -220,7 +220,7 @@ na is np.array(na) # Does make a new copy --- perhaps unnecessarily ``` To read in the array data from a text file containing numeric data use `np.loadtxt` -or `np.genfromtxt`---see [the documentation](https://docs.scipy.org/doc/numpy/reference/routines.io.html) for details. +or `np.genfromtxt`---see [the documentation](https://numpy.org/doc/stable/reference/routines.io.html) for details. ### Array Indexing @@ -464,7 +464,7 @@ B = np.ones((2, 2)) A @ B ``` -(For older versions of Python and NumPy you need to use the [np.dot](https://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html) function) +(For older versions of Python and NumPy you need to use the [np.dot](https://numpy.org/doc/stable/reference/generated/numpy.dot.html) function) We can also use `@` to take the inner product of two flat arrays @@ -1167,7 +1167,7 @@ Much of this functionality is also available in [SciPy](https://www.scipy.org/), We'll cover the SciPy versions in more detail {doc}`soon `. -For a comprehensive list of what's available in NumPy see [this documentation](https://docs.scipy.org/doc/numpy/reference/routines.html). +For a comprehensive list of what's available in NumPy see [this documentation](https://numpy.org/doc/stable/reference/routines.html). ## Speed Comparisons diff --git a/lectures/pandas.md b/lectures/pandas.md index 875d9c52..46bebb31 100644 --- a/lectures/pandas.md +++ b/lectures/pandas.md @@ -270,7 +270,7 @@ df.loc[(df.cc + df.cg >= 80) & (df.POP <= 20000), ['country', 'year', 'POP']] **Application: Subsetting Dataframe** -Real-world datasets can be [enormous](https://developers.google.com/machine-learning/data-prep/construct/collect/data-size-quality). +Real-world datasets can be [enormous](https://developers.google.com/machine-learning/crash-course/overfitting). It is sometimes desirable to work with a subset of data to enhance computational efficiency and reduce redundancy. @@ -516,7 +516,7 @@ We start with a relatively low-level method and then return to pandas. ```{index} single: Python; requests ``` -One option is to use [requests](https://requests.readthedocs.io/en/master/), a standard Python library for requesting data over the Internet. +One option is to use [requests](https://requests.readthedocs.io/en/latest/), a standard Python library for requesting data over the Internet. To begin, try the following code on your computer @@ -534,7 +534,7 @@ If you do get an error, then there are two likely causes In the second case, you can either * switch to another machine -* solve your proxy problem by reading [the documentation](https://requests.readthedocs.io/en/master/) +* solve your proxy problem by reading [the documentation](https://requests.readthedocs.io/en/latest/) Assuming that all is working, you can now proceed to use the `source` object returned by the call `requests.get('https://research.stlouisfed.org/fred2/series/UNRATE/downloaddata/UNRATE.csv')` diff --git a/lectures/python_essentials.md b/lectures/python_essentials.md index e9b252e3..8589b06e 100644 --- a/lectures/python_essentials.md +++ b/lectures/python_essentials.md @@ -401,7 +401,7 @@ with open('output2.txt', 'r') as fo: ```{note} Note that we only covered `r`, `w`, and `a` mode here, which are the most commonly used modes. -Python provides [a variety of modes](https://www.geeksforgeeks.org/reading-writing-text-files-python/) +Python provides [a variety of modes](https://www.geeksforgeeks.org/python/reading-writing-text-files-python/) that you could experiment with. ``` diff --git a/lectures/troubleshooting.md b/lectures/troubleshooting.md index fe5dfa47..1cfa95f5 100644 --- a/lectures/troubleshooting.md +++ b/lectures/troubleshooting.md @@ -33,12 +33,12 @@ You have installed Anaconda, haven't you, following the instructions in {doc}`th Assuming that you have, the most common source of problems for our readers is that their Anaconda distribution is not up to date. -[Here's a useful article](https://www.anaconda.com/keeping-anaconda-date/) +[Here's a useful article](https://www.anaconda.com/blog/keeping-anaconda-date) on how to update Anaconda. Another option is to simply remove Anaconda and reinstall. -You also need to keep the external code libraries, such as [QuantEcon.py](https://quantecon.org/quantecon-py) up to date. +You also need to keep the external code libraries, such as [QuantEcon.py](https://quantecon.org/quantecon-py/) up to date. For this task you can either diff --git a/lectures/workspace.md b/lectures/workspace.md index fe175e5b..0581e3d5 100644 --- a/lectures/workspace.md +++ b/lectures/workspace.md @@ -44,7 +44,7 @@ In this lecture, you will learn to ```{note} Going forward, it is assumed that you have an Anaconda environment up and running. -You may want to [create a new conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) if you haven't done so already. +You may want to [create a new conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) if you haven't done so already. ``` ## Working with Python files @@ -320,14 +320,14 @@ However, this is outside the focus of these lectures. This section will familiarize you with git and GitHub. -[Git](http://git-scm.com/) is a *version control system* --- a piece of software used to manage digital projects such as code libraries. +[Git](https://git-scm.com/) is a *version control system* --- a piece of software used to manage digital projects such as code libraries. In many cases, the associated collections of files --- called *repositories* --- are stored on [GitHub](https://github.com/). GitHub is a wonderland of collaborative coding projects. For example, it hosts many of the scientific libraries we'll be using later -on, such as [this one](https://github.com/pydata/pandas). +on, such as [this one](https://github.com/pandas-dev/pandas). Git is the underlying software used to manage these projects. @@ -337,9 +337,9 @@ lectures. There are two main flavors of Git -1. the plain vanilla [command line Git](http://git-scm.com/downloads) version +1. the plain vanilla [command line Git](https://git-scm.com/downloads) version 2. the various point-and-click GUI versions - * See, for example, the [GitHub version](https://desktop.github.com/) or Git GUI integrated into your IDE. + * See, for example, the [GitHub version](https://github.com/apps/desktop) or Git GUI integrated into your IDE. In case you already haven't, try @@ -361,11 +361,11 @@ As the 2nd task, 1. Look into 'forking' GitHub repositories (forking means making your own copy of a GitHub repository, stored on GitHub). 1. Fork [QuantEcon.py](https://github.com/QuantEcon/QuantEcon.py). 1. Clone your fork to some local directory, make edits, commit them, and push them back up to your forked GitHub repo. -1. If you made a valuable improvement, send us a [pull request](https://help.github.com/articles/about-pull-requests/)! +1. If you made a valuable improvement, send us a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)! For reading on these and other topics, try -* [The official Git documentation](http://git-scm.com/doc). +* [The official Git documentation](https://git-scm.com/doc). * Reading through the docs on [GitHub](https://docs.github.com/en). -* [Pro Git Book](http://git-scm.com/book) by Scott Chacon and Ben Straub. +* [Pro Git Book](https://git-scm.com/book) by Scott Chacon and Ben Straub. * One of the thousands of Git tutorials on the Net. diff --git a/lectures/writing_good_code.md b/lectures/writing_good_code.md index 081f2966..ea674215 100644 --- a/lectures/writing_good_code.md +++ b/lectures/writing_good_code.md @@ -189,7 +189,7 @@ But as a programmer, your aim should be to **automate** repetition, **not** do i More importantly, repeating the same logic in different places means that eventually one of them will likely be wrong. -If you want to know more, read the excellent summary found on [this page](https://code.tutsplus.com/tutorials/3-key-software-principles-you-must-understand--net-25161). +If you want to know more, read the excellent summary found on [this page](https://code.tutsplus.com/3-key-software-principles-you-must-understand--net-25161t). We'll talk about how to avoid repetition below.