DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk2 min

How to Create a Pandas DataFrame from a List of Dictionaries

Use pd.DataFrame(records) to convert a list of dictionaries into a table, with one dictionary per row and keys as column names.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pass the list directly to pd.DataFrame(): each dictionary becomes a row, and its keys become column names.

Create a DataFrame from a list of dictionaries

Import pandas, put your row records in a list, and pass that list to the DataFrame constructor:

As an Amazon Associate I earn from qualifying purchases.

import pandas as pd

records = [
    {"name": "Ada", "age": 36},
    {"name": "Linus", "age": 55},
]

df = pd.DataFrame(records)
print(df)

The result has one row per dictionary and columns named name and age. Values under each key fill the corresponding column. This is the ordinary, clearest pattern for row-oriented records. See the pandas.DataFrame constructor reference and the pandas table-oriented tutorial.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose and order the columns explicitly

For list-of-dictionaries input, pandas uses dictionary key insertion order for column order. If your output needs a fixed schema or a particular order, pass columns=:

df = pd.DataFrame(records, columns=["age", "name"])

The argument selects and orders the output columns. It does not check that every record contains every required field; validate such business rules separately.

Handle records with missing keys

Records can have different keys. pandas includes the supplied fields as columns and leaves a missing value in a row where its dictionary has no value for a column. For example:

records = [
    {"name": "Ada", "age": 36},
    {"name": "Linus"},
]

df = pd.DataFrame(records)

Here, the second row has no age value, so that cell is represented as missing data. If you specify a column that is absent from all records, it is also created with missing values. The from_records reference documents this behavior for explicitly requested columns.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand inferred data types and the index

By default, pandas infers data types from the supplied values. The constructor’s dtype= parameter requests a single dtype for construction; it is not a mapping for assigning separate types to different columns. For per-column type requirements, construct the DataFrame first and cast the relevant columns explicitly.

Unless you provide an index, pandas assigns a default integer RangeIndex to the rows. The constructor reference describes both dtype inference and the default index.

When to use DataFrame.from_records()

pd.DataFrame(records) is usually the most readable choice for a simple list of dictionaries. pd.DataFrame.from_records(records) is a supported alternative when its record-oriented options clarify what you need, including index, exclude, or columns.

df = pd.DataFrame.from_records(
    records,
    columns=["name", "age"],
)

Both forms accept iterable dictionaries. Use the constructor form by default; choose from_records when its additional options are useful to the conversion.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Quick checklist

  • Use pd.DataFrame(records) for one row per dictionary.
  • Use columns= when output fields or their order must be explicit.
  • Validate required keys yourself; selecting columns does not validate input records.
  • Expect pandas to infer data types and assign a RangeIndex unless you specify otherwise.

For the underlying data structure and missing-data context, see pandas’ intro to data structures.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.