Python tutorials

Loading Pydantic models from JSON without running out of memory

You have a large JSON file, and you want to load the data into Pydantic. Unfortunately, this uses a lot of memory, to the point where large JSON files are very difficult to read. What to do? Assuming you’re stuck with JSON, in this article we’ll cover: The high memory usage you get with Pydantic’s default JSON loading. How to reduce memory usage by switching to another JSON library. Going further by switching to dataclasses with slots. The problem: 20× […]

Read more

Quiz: Nested Loops in Python

Interactive Quiz ⋅ 5 QuestionsBy Philipp Acsany Share In this quiz, you’ll test your understanding of Nested Loops in Python. Nested loops in Python involve placing one loop inside another, enabling iteration over multiple sequences or repeated actions. They’re particularly useful for handling multidimensional data, generating patterns, and performing repetitive tasks with multiple layers of iteration. The quiz contains 5 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the […]

Read more

Nested Loops in Python

Nested loops in Python allow you to place one loop inside another, enabling you to perform repeated actions over multiple sequences. Understanding nested loops helps you write more efficient code, manage complex data structures, and avoid common pitfalls such as poor readability and performance issues. By the end of this tutorial, you’ll understand that: Nested loops in Python involve placing one loop inside another, enabling iteration over multiple sequences or repeated actions. Situations where nested loops are a good idea […]

Read more

First Steps With LangChain

You’ve likely interacted with large language models (LLMs), like the ones behind OpenAI’s ChatGPT, and experienced their remarkable ability to answer questions, summarize documents, write code, and much more. While LLMs are remarkable by themselves, with a little programming knowledge, you can leverage libraries like LangChain to create your own LLM-powered applications that can do just about anything. In this video course, you’ll learn how to: Use LangChain to build LLM-powered applications Create reusable instructions with prompt templates Create and […]

Read more

Quiz: How to Group Data Using Polars .group_by()

Interactive Quiz ⋅ 10 QuestionsBy Ian Eyre Share In this quiz, you’ll test your understanding of the techniques covered in How to Group Data Using Polars .group_by(). By working through the questions, you’ll review your understanding of how to use the data aggregation and grouping techniques provided by Polars. You’ll need to do some research outside of the tutorial to answer all the questions, so let this challenge take you on a learning journey. The quiz contains 10 questions and […]

Read more

How to Group Data Using Polars .group_by()

One of the most common tasks you’ll encounter when analyzing Polars data is the need to summarize it. You can use the Polars .group_by() method to create groupings based on column values. A related summarization technique is aggregation, where you take a sequence of related values and condense them into a single value. By the end of this tutorial, you’ll understand that: You can summarize data using aggregation. You can use .filter() to view specific data. Using .group_by() allows you […]

Read more

Quiz: Getting Started With Python IDLE

Interactive Quiz ⋅ 7 QuestionsBy Philipp Acsany Share In this quiz, you’ll test your understanding of Python IDLE. Python IDLE is an IDE included with Python installations, designed for basic editing, execution, and debugging of Python code. You can also customize IDLE to make it a useful tool for writing Python. The quiz contains 7 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total […]

Read more

Working With Missing Data in Polars

Efficiently handling missing data in Polars is essential for keeping your datasets clean during analysis. Polars provides powerful tools to identify, replace, and remove null values, ensuring seamless data processing. This video course covers practical techniques for managing missing data and highlights Polars’ capabilities to enhance your data analysis workflow. By following along, you’ll gain hands-on experience with these techniques and learn how to ensure your datasets are accurate and reliable. By the end of this video course, you’ll understand […]

Read more

Python’s T-Strings Coming Soon and Other Python News for May 2025

Welcome to the May 2025 edition of the Python news roundup. Last month brought confirmation that Python will have the eagerly-awaited template strings, or t-strings, included in the next release. You’ll also read about other key developments in Python’s evolution from the past month, updates from the Django world, and exciting announcements from the community around upcoming conferences. From new PEPs and alpha releases to major framework updates, here’s what’s been happening in the world of Python. PEP 750: Template […]

Read more

Quiz: Python Logging With the Loguru Library

Interactive Quiz ⋅ 9 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of How to Use Loguru for Simpler Python Logging. By working through this quiz, you’ll revisit key concepts like installing Loguru, basic logging, formatting, sinks, log rotation, and capturing exception information. The quiz contains 9 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is […]

Read more
1 7 8 9 10 11 199