AI engineering glossary · NumPy pandas visualization

What is dataFrame?

DataFrame (also called df): Pandas' two-dimensional table of data with labelled rows and named columns. Each column is a Series and can hold its own data type, so numbers, text and dates can sit side by side. It resembles a spreadsheet or a database table and is the central object of data analysis in Python.

Level: beginnerTopic: NumPy pandas visualization

DataFrame: an example

pd.DataFrame({'name': ['Asha', 'Ravi'], 'age': [28, 34]}) makes a table with two rows and two columns.

DataFrame in Python

A short example you can run (Python 3.11). The output below is what it really prints.

import pandas as pd

df = pd.DataFrame({"city": ["Pune", "Delhi", "Pune", "Chennai"], "orders": [12, 30, 8, 15]})
print(df.groupby("city")["orders"].sum().sort_values(ascending=False))

Output

city
Delhi      30
Pune       20
Chennai    15
Name: orders, dtype: int64

Related terms

More NumPy pandas visualization terms

Where you learn it

DataFrame is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.