Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Getting Started

What is Python?

Python is a high-level general-purpose programming language. It is widely known because it is efficient and easy to learn. Contextualizing it, Python is a powerful tool for:

  • Data Cleaning: Automating the processing of thousands of survey records.

  • Analysis: Calculating crop yields, poverty incidence, and other statistics.

  • Geospatial Processing: Analyzing farm locations and land use.

You can read more about Python here: AWS: What is Python?

Kumusta mundo!

Output
Kumusta mundo!

Libraries and Modules

What are libraries?

  • A collection of pre-written code and functionalities that can be reused in other applications/scripts

  • Saves time and effort by providing ready-made solutions for common tasks

  • DRY principle - DON’T REPEAT YOURSELF

Python Standard Library

  • Comes bundled with Python and includes a wide range of modules for various tasks.

  • Examples include math for mathematical operations and os for interacting with the operating system.

Third-Party Libraries

  • Developed by the Python community or external developers.

  • Extend Python’s functionality beyond the standard library.

  • Examples include:

    • numpy for numerical computing

    • polars for lightning-fast dataframes

    • duckdb for SQL queries directly embedded in Python code

  • Where to find? Try PyPI the Python Package Index.

How to Import a Library in Python?

We use the import keyword to bring a tool into our script.

CommandExplanation
import mathImports the whole toolbox. You use it like math.sqrt().
import pandas as pdImports it but gives it a nickname (pd) to save typing.
from math import sqrtImports only one specific tool.
from math import *Imports everything blindly.

Source: Adapted from Python 3 Documentation: Modules

Output
5.0
Output
5.0
Output
5.0

Please avoid using the last method above. While this approach works, it is not recommended. Why do you think so?

Output
2026-01-13
Output

How will you get today’s date?