Autonomous Econ is a newsletter dedicated to empowering economists and policy analysts with Python and data science skills, enhancing their productivity via automation and setting their work apart from peers.
Upcoming posts will roughly be split between practical guides (80 percent) and data journalism pieces where I demonstrate the tools (20 percent).
If you find the content valuable, please consider becoming a free subscriber by clicking on the button below.
Last week, I discussed how Python can assist the everyday economist (see article). From economic modeling to web scraping and interactive dashboards, Python's versatility has led to its surge in popularity over other languages like Matlab. This growth has fostered a large and active online community, offering a ton of resources to support your journey.
However, the versatility of Python means that the sheer number of online courses and tutorials can be overwhelming. Many people are unsure where to begin and may not have the time to dedicate to a 5-day workshop.
In this post, I aim to cut through the noise and offer an overview of the Python packages most useful for economists and policy analysts, tailored to your specific use case. This Python starter guide features a curated list of interactive tutorials and resources, providing a practical primer before tackling real-world problems. I'll guide you on how to minimize time spent on technical setup and theory, focusing instead on application to rapidly deliver value.
The intended audience for this guide and prerequisites
Before I start, I want to clarify that this guide is not aimed at those aspiring to become data scientists. It will not cover certain best practices and skills essential for professional machine learning engineers and data scientists, such as test-driven development, which enables code deployment at scale.
My target audience consists of individuals looking to prototype to automate mundane tasks and elevate their data-driven projects, rather than those focused on scaling their code to develop a product.
Regarding prerequisites, experience with other scripting languages like EViews, Stata, R, Matlab, or Julia is beneficial. However, Python is quite intuitive, featuring an English-like syntax, making it relatively easy to pick up. A solid background in calculus and statistics is only necessary if you plan to dive into predictive modeling.
The Python starter guide
In the starter guide below, I've mapped out the applications and packages that could be useful for beginners who are completely new to Python. It highlights topics that are most relevant for economists and policy analysts.
For each topic, I've curated an index of interactive courses available in the footer of this post.1 My selections are based on resources I've found useful in the past, with an emphasis on free and interactive tutorials wherever possible.
Instead of exhaustively covering each topic, you can select a branch based on your project needs and use the recommended resources as a starting point. For those completely new to Python, I suggest spending a little time on the fundamentals branch—learning the basic syntax of Python and how to manipulate data with Pandas. These are essential skills for working with any of the other packages.
Note that there are other topics I haven't included yet to avoid overwhelming readers, such as web-app dashboards, Git version control, natural language processing, and automating models. I plan to cover these in an intermediate version of this guide in the future.
Yes, learning Python remains essential even if generative AI chatbots like ChatGPT can write code for you. Why? Because understanding how to debug and validate their output is crucial.
emphasizes this point well in his post:ChatGPT and similar tools have significantly reduced the effort and expense involved in learning and using Python for personal projects. By enabling individuals to incorporate AI into their work to tackle problems, these tools open up new career possibilities and provide a means to future-proof one's career.
Quickly apply knowledge to real-world projects and avoid getting bogged down in technical setup
As someone without a computer science background, I initially found it challenging to navigate the myriad ways to run Python on my PC. Using the terminal window and Git can also be unintuitive for most people without programming experience. It can be demotivating to encounter roadblocks with the setup, so avoid getting mired in this aspect.
Thankfully, cloud-based notebooks like Google Colab now make it much easier to start projects without even having to install Python on your PC. Many course platforms, such as Kaggle, also feature built-in notebooks on their websites for running code. Notebooks enable you to upload your own data and intuitively understand what the code is doing at every step. For a deeper understanding of what notebooks are, check out this handy intro on Technically.
Here's the general learning process I would suggest to follow to learn and apply Python quickly:
Select a branch from the guide that aligns with your use case or business problem, and follow an interactive tutorial to grasp the basic concepts. I'll provide further inspiration for various use cases in future posts.
Open a Google Colab notebook and load any necessary data for your project.
Use ChatGPT (available for free on Bing or any other tool you prefer) to ask for boilerplate code or a minimal template tailored to your use case.
Execute the code in Colab and repeat step 3, refining your approach until you achieve your desired outcome.
Using generative AI tools like ChatGPT or Bard is often more efficient than searching for hands-on tutorials tailored to your specific use case. They essentially act as a personal coding coach.
I hope you find this pragmatic guide helpful. While some might view it as a shortcut approach, it's important to recognize that not everyone has the luxury of time for extensive learning and development, nor does everyone aspire to become a professional data scientist. The reality is, many people want to learn just enough to begin prototyping solutions for real-world problems. Your intuition will naturally improve as you encounter and overcome challenges. Starting with Python in this manner will unlock numerous opportunities to enhance your work and make your resume more impressive.
Below is a curated index of resources. Note that for QuantEcon tutorials, you can launch a notebook in the browser. Find the play button in the top right corner and select 'Colab' in the 'Public' field. If you're new, you can refer to this basic Google Colab tutorial.
For packages without interactive tutorials, you can consult the documentation and use ChatGPT to gain intuition.
Python fundamentals:
Data manipulation with Pandas:
Scientific tools:
Charts:
Maps:
Prediction Models:
Regression / classification
Time-series:
Unsupervised learning - Kaggle
Working with text:
Webscraping:
Just a quick question for you. I can do all this with mathematica. Right?