liveBook · Manning

Data manipulation routine

As explained in The Well-Grounded Data Analyst

Data manipulation is the process of sorting, grouping, reshaping, or otherwise transforming data to support analysis.

A data manipulation routine transforms raw or combined datasets into forms suitable for analysis, visualization, statistical investigation, or an interactive proof of concept. Typical operations include filtering, sorting, grouping, and reshaping. section 6.2.4 section 10.2.4

A practical routine usually moves through these tasks:

Filtering a house-price explorer

An interactive application lets users select a county, town, and street. The routine builds a progressively specific query, retrieves the matching records, calculates record count and median sale price, and supplies charts and a raw-data table. section 11.2.2 section 11.2.2

house_filter_query = "county == @county_select"
filter_message = f"Results for {county_select}"

if town_select and town_select != TOWN_NULL_VALUE:
    house_filter_query += " and town_city == @town_select"
    filter_message += f", {town_select}"

if street_select and street_select != STREET_NULL_VALUE:
    house_filter_query += " and street == @street_select"
    filter_message += f", {street_select}"

selected_data = wales.query(house_filter_query)

Inspect an executable pandas pattern for constructing conditional geographic filters and retrieving the selected data. section 11.2.2

How The Well-Grounded Data Analyst covers it

How deep it goes
Details filtering, sorting, grouping, reshaping, combining, and query construction, but stops short of implementation-independent algorithmic internals.
Examples
Uses combined CSV or Excel datasets, geographic house-price filters, summary metrics, charts, raw-data tables, and large time-series files.
What it assumes
Assumes a toolkit that can read, explore, and visualize data, while leaving language and library choices open.
What you can do after
Apply it via pandas to prepare, filter, summarize, visualize, and feed datasets into analyses or interactive prototypes.
How it connects
Connects data loading with data visualization, statistical analysis, time series analysis, forecasting, and interactive applications.

Also explained in

Compare how 2 books explain data manipulation routine →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Data Analyst. The section links point to the parts of the book it draws on.