COMP9321 · 03 Joining data · Terms

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/29

encourage image

There's no tags or description

Looks like no tags are added yet.

30 Terms

1
New cards
Data wrangling
Reshaping clean data into the form the analysis needs: combining, grouping, pivoting, deriving columns. ✎ Exam: After cleaning, ___ joins orders to customers and aggregates sales per region.
2
New cards
Concatenate
Stack datasets with the same columns on top of each other (more rows), pd.concat. ✎ Exam: I ___ January and February sales because they share the same columns.
3
New cards
Merge
Combine different columns about the same entity by a key (like SQL JOIN), pd.___. ✎ Exam: I ___ Orders with Customers on Customer ID to add each customer's city.
4
New cards
Inner join
Keeps only rows with a match in both tables. ✎ Exam: An ___ on Customer ID keeps only C001 and C002, which appear in both tables.
5
New cards
Left join
Keeps all rows of the left table; right-table fields are NaN where there is no match. ✎ Exam: A ___ keeps every order; C003's profile fields become NaN.
6
New cards
Outer join
Keeps every row from both tables, NaN where there is no match. Good for auditing what doesn't match. ✎ Exam: An ___ shows C003 (order only) and C004 (customer only), so I can audit the mismatch.
7
New cards
Anti-join
Rows of one table with no match in the other. Used to find broken references before/after a join. ✎ Exam: An ___ finds the 40 orders whose customer ID is not in Customers.
8
New cards
Row explosion
Duplicate keys multiply rows in a join (2 matching × 3 matching = 6 rows). Dedupe before joining and check the row count after. ✎ Exam: Customer C001 appears twice in each table, so the join creates 4 rows: ___. Deduplicate first.
9
New cards
Groupby
Split rows into ___, apply a function (sum, mean, count) to each, combine the results. ✎ Exam: ___('region')['sales'].mean() gives the average sales per region.
10
New cards
Pivot table
Reshape into rows × columns × aggregated values: a summary, no longer one row per record. ✎ Exam: A ___ with regions as rows, months as columns and summed sales as values.
11
New cards
Vectorised operation
Whole-column arithmetic (df.a * df.b) instead of looping over rows; much faster than iterrows. ✎ Exam: I compute revenue as a ___, df.price * df.qty, rather than looping.
12
New cards
Patching
Filling missing data from another source or a rule (combine_first fills a frame's NaN from another frame). ✎ Exam: Missing cities are ___ from the postcode table.
13
New cards
Feature
One measurable input property of an item (age, monthly charges, contract type). ✎ Exam: Tenure is a useful ___ for predicting churn.
14
New cards
Derived feature
A new column computed from existing ones: tenure from join date, charge per GB, calls per month, day of week, ratios. ✎ Exam: I ___ charge per GB = monthly charges / data used, because it shows value for money.
15
New cards
One-hot encoding
Turn a category into 0/1 columns, one per value. Drop one column for linear models (dummy-variable trap). ✎ Exam: Contract Type is one-hot ___ into Monthly / One-year / Two-year columns.
16
New cards
Ordinal encoding
Map ordered categories to ordered numbers (Low=0 < Medium=1 < High=2). Only when there is a real order. ✎ Exam: Rating Low/Medium/High has an order, so ___ keeps it.
17
New cards
Standardisation
Scale a feature to mean 0, standard deviation 1 (z-score). Needed for distance- or gradient-based models (k-NN, k-means, regularised regression). ✎ Exam: Income and age are standardised so income's large range doesn't dominate the k-NN distance.
18
New cards
Data leakage
Using information you wouldn't have at prediction time (a future value, the target itself, test data). Gives an over-optimistic score. ✎ Exam: Revenue is only known after release, so using it to predict rating is ___.
19
New cards
Concatenate
Scenario: Two monthly sales files with identical columns must become one table. Why: ___: same columns, so stack the rows.
20
New cards
Merge
Scenario: Orders and Customers tables share Customer ID; you need the customer's city next to each order. Why: ___ (join) on the key Customer ID: different columns about the same entity.
21
New cards
Inner join
Scenario: You only want orders that have a full customer profile. Why: ___: keeps rows matched in both tables.
22
New cards
Left join
Scenario: You analyse orders and must not lose any, even ones whose customer is missing from Customers. Why: ___ (Orders on the left): all orders kept, missing profiles become NaN.
23
New cards
Outer join
Scenario: You want to see every key from both tables to check which ones don't match. Why: ___: everything from both, mismatches visible.
24
New cards
Row explosion
Scenario: After a join, the table has far more rows than either input. Why: ___: duplicate keys multiply matches. Deduplicate before joining, check row counts.
25
New cards
Groupby
Scenario: You need average sales per region. Why: ___ region + aggregate (mean).
26
New cards
Pivot table
Scenario: Rows = region, columns = month, cells = total sales. Why: ___: a reshaped summary.
27
New cards
Patching
Scenario: df2 has missing fields; fill them from df1 where df1 has values (past MCQ). Why: ___ with df2.combine_first(df1): df2's NaN filled from df1. (The tutor's slide highlighted the reverse; that's a slide error.)
28
New cards
Derived feature
Scenario: You have join date and today's date, monthly charges and GB used. Why: ___ ___: tenure (today − join date), charge per GB (charges / GB).
29
New cards
One-hot encoding
Scenario: Contract Type has values Monthly, One-year, Two-year with no order, and the model needs numbers. Why: ___: no order between the values.
30
New cards
Data leakage
Scenario: A model predicting a film's rating uses its box-office revenue, known only after release. Why: ___: that feature isn't available when predicting.