Start learning
Explore Bezadome

Learn from the best to be the best.

Find your category

Agribusiness & Cooperative Management

Hospitality, Tourism & Events

Business & Entrepreneurship

Leadership & Career Development

Design, Media & Content Creation

Modern Workplace Skills

Procurement & Logistics

Fashion, Tailoring, Footwear & Accessories

Music, Dance & Sound

Computer & Digital Skills

Sales & Marketing

AI and Digital Productivity

Data and Business Analysis

Fitness, Movement & Wellbeing

Digital Marketing & Social Media

Human Resources & Workplace Safety

Project and Community Impact

Hair, Barbering, Beauty & Salon Services

Public Speaking, Communication & PR

Construction, Property & Facilities Operations

English for Life, Study, Work and Business

Household Services & Care

Customer Care & Service Operations

Energy & Mineral Industries

Finance, Bookkeeping & Money Management

Education, Tutoring & Training Design

Environment, Forestry & Sustainability

IT Support & Software Quality

Languages

Manufacturing & Quality Operations

Office Administration

Retail Operations

Healthcare Administration

Profile a file before choosing its types

15 min estimated lesson time

View full course

Preview progress is not saved.

Count rows, keys and observed durations

Use these three controls when comparing the SQLite and pandas imports of orders.csv.

  • All rows96 records
  • Distinct order IDs96 records
  • Nonblank delivery days92 records
Check your reading

The keys are unique. Four durations are missing. COUNT(days_to_deliver) in SQLite and Series.count() in pandas should both return 92 after importing those blanks as missing values.

Open the case files, data dictionary and portfolio challenge

Create a project folder with a data subfolder and put the downloaded CSVs there. Open a terminal in the project folder. Use python -m venv .venv and the environment’s Python to install pandas. Save the interpreter and pandas versions in your handover. The database in this course runs inside Python using sqlite3.

Treat identifiers as text even when they contain digits. A missing elapsed time has a different meaning from zero elapsed days. Parse the date with the expected ISO layout and raise an error on invalid input. Before calculation, write down what one row represents, which column must be unique and which columns permit blanks.

Start a file called report.py with the following. Run it from this folder after each addition. Keep the original files intact.

from pathlib import Path
import sqlite3
import pandas as pd
data = Path("data")
def read_orders(filename):
    frame = pd.read_csv(data / filename, dtype={"order_id": "string", "product_id": "string", "branch": "string", "days_to_deliver": "Int64"})
    frame["order_date"] = pd.to_datetime(frame["order_date"], format="%Y-%m-%d", errors="raise")
    return frame
orders = read_orders("orders.csv")
products = pd.read_csv(data / "products.csv", dtype="string")
targets = pd.read_csv(data / "targets.csv", parse_dates=["month"])
print(orders.shape, orders["order_id"].nunique(), orders.isna().sum())
YOUR NEXT STEP

Explore the complete course.

Review the curriculum, requirements and enrolment options before you decide.

PASS ON A POSSIBILITY

Share this course

Help a friend or colleague discover their next skill.

Share on WhatsAppChoose who to share with in WhatsApp. You decide what to send.
Recommend to your team by email