For the past three years, I’ve had the privilege of attending the Python Conference (PyCon) in the United States. PyCon US is a yearly event where Pythonistas get together to talk and learn about Python. It’s a great place to learn, meet new fellow Python devs, and get some seriously cool swag. The first time […]
Category: Data Analytics
Logging in Python
Logging is a very useful tool in a programmer’s toolbox. It can help you develop a better understanding of the flow of a program and discover scenarios that you might not even have thought of while developing. Logs provide developers with an extra set of eyes that are constantly looking at the flow that an […]
Using Firefox Extensions with Selenium in Python
Firefox is my personal favorite browser, due in part to all of the great extensions available for it. When you try running Firefox with Selenium, however, you’ll probably find that Firefox is missing the extensions you have installed and normally use when browsing. Luckily, there’s a quick and easy way to install all your favorite […]
The Best Python Books
Python is an amazing programming language. It can be applied to almost any programming task, allows for rapid development and debugging, and brings the support of what is arguably the most welcoming user community. Getting started with Python is like learning any new skill: it’s important to find a resource you connect with to guide […]
Python Aggregate UDFs in Pyspark
Pyspark has a great set of aggregate functions (e.g., count, countDistinct, min, max, avg, sum), but these are not enough for all cases (particularly if you’re trying to avoid costly Shuffle operations). Pyspark currently has pandas_udfs, which can create custom aggregators, but you can only “apply” one pandas_udf at a time. If you want to […]
Conditional Statements in Python
From the previous tutorials in this series, you now have quite a bit of Python code under your belt. Everything you have seen so far has consisted of sequential execution, in which statements are always performed one after the next, in exactly the order specified. But the world is often more complicated than that. Frequently, […]
Python Virtual Environments in Five Minutes
In Python, virtual environments are used to isolate projects from each other (if they require different versions of the same library, for example). They let you install and manage packages without administrative privileges, and without conflicting with the system package manager. They also allow to quickly create an environment somewhere else with the same dependencies. […]
Structuring Python Programs
You have now covered Python variables, operators, and data types in depth, and you’ve seen quite a bit of example code. Up to now, the code has consisted of short individual statements, simply assigning objects to variables or displaying values. But you want to do more than just define data and display it! Let’s start […]
Python Pandas: Tricks & Features You May Not Know
Pandas is a foundational library for analytics, data processing, and data science. It’s a huge project with tons of optionality and depth. This tutorial will cover some lesser-used but idiomatic Pandas capabilities that lend your code better readability, versatility, and speed, à la the Buzzfeed listicle. If you feel comfortable with the core concepts of […]
Primer on Python Decorators
In this tutorial on decorators, we’ll look at what they are and how to create and use them. Decorators provide a simple syntax for calling higher-order functions. By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it. This sounds confusing, but it’s […]
Sets in Python
Perhaps you recall learning about sets and set theory at some point in your mathematical education. Maybe you even remember Venn diagrams: If this doesn’t ring a bell, don’t worry! This tutorial should still be easily accessible for you. In mathematics, a rigorous definition of a set can be abstract and difficult to grasp. Practically […]
The Ultimate Guide to Django Redirects
When you build a Python web application with the Django framework, you’ll at some point have to redirect the user from one URL to another. In this guide, you’ll learn everything you need to know about HTTP redirects and how to deal with them in Django. At the end of this tutorial, you’ll: Be able […]
Advanced Git Tips for Python Developers
If you’ve done a little work in Git and are starting to understand the basics we covered in our introduction to Git, but you want to learn to be more efficient and have more control, then this is the place for you! In this tutorial, we’ll talk about how to address specific commits and entire […]
Python Community Interview With Mike Driscoll
Welcome to the first in a series of interviews with members of the Python community. If you don’t already know me, my name is Ricky, and I’m the Community Manager here at Real Python. I’m a relatively new developer, and I’ve been part of the Python community since January, 2017, when I first learned Python. […]
Dictionaries in Python
Python provides another composite data type called a dictionary, which is similar to a list in that it is a collection of objects. Here’s what you’ll learn in this tutorial: You’ll cover the basic characteristics of Python dictionaries and learn how to access and manage dictionary data. Once you have finished this tutorial, you should […]