Python's Superpower: Its Ecosystem
What makes Python the world's most popular programming language isn't just the language itself — it's the massive ecosystem of free libraries built by developers around the world. There are over 450,000 free packages available. Whatever you want to build, someone has probably already built the hardest parts for you.
Installing libraries with pip
pipPython's package manager. Use it in your terminal to download and install libraries from the internet. is Python's package manager — think of it as an App Store for Python libraries. You run it in your terminal (not inside Python code) to install new libraries.
# Run this in your TERMINAL (not Python!): pip install numpy pip install pandas pip install requests # Then import it inside your Python code as usual: import numpy as np
as np part is an alias — just a shorter nickname so you don't have to type numpy every time. import numpy as np and import pandas as pd are industry-wide conventions.
Fast math with huge datasets
NumPy (Numerical Python) is the foundation of almost all data science in Python. It introduces the array — a super-powered list that can do math on millions of numbers simultaneously, hundreds of times faster than a regular Python loop.
import numpy as np scores = np.array([88, 92, 79, 95, 85]) print("Average:", np.mean(scores)) print("Max:", np.max(scores)) print("Min:", np.min(scores)) print("Doubled:", scores * 2)
Python's Excel
Pandas lets you work with tabular data (like a spreadsheet) directly in Python. It introduces the DataFrame — a table with rows and columns that you can filter, sort, group, and analyse with incredibly simple code.
import pandas as pd data = { "Name": ["Alice", "Bob", "Charlie"], "Score": [88, 92, 79] } df = pd.DataFrame(data) print(df) print("\nAverage Score:", df["Score"].mean())
Fetching data from websites and APIs
The requests library lets your Python program act like a web browser — it can fetch web pages and talk to APIs (Application Programming Interfaces) to retrieve real-time data like weather, cryptocurrency prices, or news headlines.
import requests # Fetch data from a public API response = requests.get("https://api.github.com") print("Status:", response.status_code) # 200 = OK! print("Response:", response.json()) # Get data as a dict
requests library requires an actual internet connection and runs locally. You can't run it in our in-browser playground, but it works perfectly in any local Python install!
Think about building a house. You could chop down trees, mill your own lumber, smelt your own nails, and fire your own bricks from raw clay.
Or you could just go to B&Q and buy pre-made lumber, nails, and bricks — then use them to build something great without starting from zero.
Python libraries are the B&Q of programming. Someone else did the hard, boring foundational work. You just pip install it and build the interesting parts.
The Python Ecosystem
The Data Scientist
pip install pandas..."df["Score"].mean()df["Score"].max()NumPy & Pandas in Action
NumPy and Pandas are available right here in the browser via Pyodide. Try them out!
- Change the scores array. Try using
np.min()to find the lowest score. - Add a third student "Charlie" with a score of 79 to the DataFrame and print it again.
- Try
df.describe()— it generates a full statistical summary in one line!
Real World Tools — Done! 🌐
- Python has 450,000+ free libraries available to install.
- Use pip install library-name in your terminal to download any library.
- NumPy: Super-powered arrays for fast number crunching. Import as
np. - Pandas: Work with table data (like Excel spreadsheets) in Python. Import as
pd. - Requests: Let your Python code talk to the internet and fetch data from APIs.
import library as aliaslets you use a shorter name when calling functions.