Skip to content

Python Dictionaries

How to Append a Dictionary to a List in Python Cover Image

How to Append a Dictionary to a List in Python

Python lists are mutable objects that can contain different data types. Because of this, you’ll often find yourself appending items to lists. In this tutorial, you’ll learn how to append a dictionary to a list in Python. While this may

Convert JSON to a Python Dictionary Cover Image

Convert JSON to a Python Dictionary

In this tutorial, you’re going to learn how to convert a JSON file or string into a Python dictionary. Being able to work with JSON data is an important skill for a Python developer of any skill level. In most

Python map Function Transforming Iterables without Loops Cover Image

Python map Function: Transforming Iterables without Loops

In this tutorial, you’ll learn how to use the built-in Python map() function. This function allows you to process and transform, or “map”, items in an iterable without needing to use a loop to iterate. The function allows you to

Python filter A Complete Guide to Filtering Iterables Cover Image

Python filter: A Complete Guide to Filtering Iterables

The Python filter function is a built-in way of filtering an iterable, such as a list, tuple, or dictionary, to include only items that meet a condition. In this tutorial, you’ll learn how to use the filter() function to filter

Python Nested Dictionary Cover Image

Python Nested Dictionary: Complete Guide

In this tutorial, you’ll learn about Python nested dictionaries – dictionaries that are the values of another dictionary. You’ll learn how to create nested dictionaries, access their elements, modify them and more. You’ll also learn how to work with nested

Copy a Python Dictionary Cover Image

Copy a Python Dictionary: A Complete Guide

In this tutorial, you’ll learn all the different ways to copy a Python dictionary. While this may seem like a very rudimentary task, there are a number of complexities involved in this. In this tutorial, you’ll learn how to copy

Covert a List of Dictionaries to a Pandas DataFrame Cover Image

Convert a List of Dictionaries to a Pandas DataFrame

In this tutorial, you’ll learn how to convert a list of Python dictionaries into a Pandas DataFrame. Pandas provides a number of different ways in which to convert dictionaries into a DataFrame. You’ll learn how to use the Pandas from_dict

Find Duplicates in a Python List Cover Image

Find Duplicates in a Python List

In this tutorial, you’ll learn how to find and work with duplicates in a Python list. Being able to work efficiently with Python lists is an important skill, given how widely used lists are. Because Python lists allow us to

Python Defaultdict Overview and Examples Cover image

Python Defaultdict: Overview and Examples

In this tutorial, you’ll learn about the Python defaultdict objects, which is part of the collections library. The object overrides the default dictionary behavior of throwing a KeyError when you try to access a key that doesn’t exist. You’ll get

Python Dictionaries A Complete Overview Cover Image

Python Dictionaries: A Complete Overview

Python dictionaries are an incredibly useful data type, which allow you to store data in key:value pairs. In this tutorial, you’ll learn all you need to know to get up and running with Python dictionaries, including: Let’s get started! What

How to Add Items to a Python Dictionary Cover Image

Python: Add Key:Value Pair to Dictionary

In this tutorial, you’ll learn how to add key:value pairs to Python dictionaries. You’ll learn how to do this by adding completely new items to a dictionary, adding values to existing keys, and dictionary items in a for loop, and

Python Sort Dictionary by Its Values Cover Image

Python: Sort a Dictionary by Values

Learn to use Python to sort a dictionary by its values, ascending or descending, using sorted, for loops and dictionary comprehensions.