Learn / Python for AI

Python for AI

The Python behind modern AI: NumPy, pandas, charts, machine learning, LLM APIs, RAG and AI apps.

7 free lessons · about 1.7 hours · runnable code, exercises and quizzes

  1. 1NumPyNumPy for AI and data: arrays and shapes, vectorised maths, broadcasting, boolean masks, aggregations along axes, random numbers, and dot products and cosine similarity for embeddings.13 min
  2. 2pandaspandas essentials: DataFrames, reading CSV, selecting and filtering rows, adding columns, groupby and aggregation, sorting, handling missing values and preparing data for machine learning.14 min
  3. 3Charts with MatplotlibPlot data in Python with matplotlib: line, bar and scatter charts, titles and labels, several charts side by side, plotting straight from pandas, and saving charts as images.11 min
  4. 4Machine learning with scikit-learnYour first machine learning models in Python with scikit-learn: features and labels, train/test split, fit and predict, accuracy and confusion matrix, pipelines with scaling, and regression.15 min
  5. 5Calling LLM APIsUse large language models from Python: API keys, messages and system prompts, tokens and cost, streaming, structured JSON output validated with Pydantic, retries and good habits for production.15 min
  6. 6RAG basicsRetrieval-augmented generation explained with runnable Python: chunking documents, scoring relevance, retrieving the best chunks, building a grounded prompt, and moving to embeddings and vector databases.16 min
  7. 7AI apps with FastAPITurn Python AI code into a web API with FastAPI: routes, request validation with Pydantic, async endpoints that call an LLM, streaming responses, automatic docs, testing and deployment tips.16 min