Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

DataFrames: Tabular | Master Data Science with Python lesson | BraveProgrammer
  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 18 of 60

·python

DataFrames: Tabular Data in Pandas

20 minutes

Course progress30%

DataFrames Basics

A DataFrame is a 2‑dimensional labeled data structure with columns of potentially different types.

Creating DataFrames

import pandas as pd

# From a dict of lists
df = pd.DataFrame({
    "city": ["NY", "LA", ],
    : [, , ],
    : [, , ]
})
(df)
"SF"
"population"
8.4
4.0
0.9
"area"
783
1214
600
print

Inspecting DataFrames

print(df.head())    # first 5 rows
print(df.info())    # summary
print(df.describe())   # numeric stats

Selecting columns

pop = df["population"]
print(pop)

Adding a new column

df["density"] = df["population"] / df["area"]
print(df)

Info

Missing values appear as NaN. Use .isna() to spot them.
Make it stickPractice what you've learned1 quiz · 4 practical tests · Optional activities from Master Data Science with PythonBrowse activities
Previous lessonSeries: The One‑Dimensional Pandas ObjectContinue to lesson 19Reading Data: CSV, Excel, JSON, and MoreBack to Master Data Science with Python curriculum