Chapter 4 · 6 levels
pandas first look
Meet the DataFrame. Open Harbor & Pine's real tables, check their size and types, pick columns and get quick summaries with value_counts and describe.
StartFrom here on you work with the real Harbor & Pine data: 12,000 orders, 30,000 order lines, 2,000
customers, 120 products, and more. It’s far too much to loop over by hand, and that’s what
pandas is for. pandas is the Python library analysts use for tables. It’s already imported as
pd (and NumPy as np), and every table is preloaded as a DataFrame with the table’s name:
orders, order_items, customers, products, returns, employees, web_sessions and
marketing_spend.
The first thing a good analyst does with any new table is look at it. How many rows? What are the
columns and their types? What values show up, and how often? Are there gaps? This chapter teaches
that first look: head, shape, info, selecting columns, value_counts and describe. It
sounds basic, but skipping it is how wrong numbers end up in front of a VP.
Levels
- Pick the columns you need
from Logan Brooks, Email Marketing Specialist
column selection, series, dataframe, double brackets
- Boss: the first-look report
from Priya Shah, Head of Data
nunique, value counts, normalize, describe, round