▸case-01 I have a Pandas DataFrame `df` with sales transactions containing `month`, `region`, and `sales`. When generating a cross-tabulated pivot summary, missing region/month combinations currently result in NaN values, but I need them to display as 0 for downstream calculations without chaining separate fillna operations. How should I write the Pandas call? | pass→pass | 12,300 | 10,667 | -13% | 1 | 1 | 0% | 1,418 | 1,444 | +2% | 0 | 0 | — |
▸case-02 I need to summarize a Pandas DataFrame `df` of retail data by `category` on rows and `year` on columns. I want to compute both total sales volume and average discount percentage in the same table. Plain df.pivot() fails here. What is the standard Pandas call? | pass→pass | 13,729 | 12,015 | -12% | 1 | 1 | 0% | 1,774 | 1,661 | -6% | 0 | 0 | — |
▸case-03 I need to write an ANSI-compliant standard SQL query to cross-tabulate order counts by year (rows) and quarter (Q1, Q2, Q3, Q4 as columns) from an `orders` table. I want to avoid database-vendor-specific extensions like Oracle or MSSQL PIVOT keywords to ensure full portability across engines. How should this be written? | pass→pass | 15,492 | 17,457 | +13% | 1 | 1 | 0% | 2,206 | 2,921 | +32% | 0 | 0 | — |
▸case-04 In Microsoft Excel, I have a pivot table built from raw transaction data with `Revenue` and `Cost` fields. I need to display Profit Margin (`(Revenue - Cost) / Revenue`) inside the pivot table. Modifying the underlying source worksheet by adding new data columns is restricted by protocol. What native pivot feature should I use? | pass→pass | 12,626 | 11,762 | -7% | 1 | 1 | 0% | 1,311 | 1,494 | +14% | 0 | 0 | — |
▸case-05 I am building a matrix in Pandas using `df.pivot_table` with `product_line` on index and `store_region` on columns, aggregating `revenue`. I need grand totals automatically calculated for both rows and columns in the output DataFrame. Instead of manually appending `sum()` rows, what parameter should be passed? | pass→pass | 7,996 | 8,889 | +11% | 1 | 1 | 0% | 533 | 1,157 | +117% | 0 | 0 | — |
▸case-06 I am querying a DuckDB database table named `quarterly_sales` containing `region`, `quarter`, and `revenue`. I want to use DuckDB's native explicit `PIVOT` clause (rather than manual CASE aggregation) to transform `quarter` values into columns. What is the syntax? | pass→pass | 12,789 | 12,798 | +0% | 1 | 1 | 0% | 1,481 | 1,807 | +22% | 0 | 0 | — |
▸case-07 I have an event log DataFrame `df` with a datetime column `timestamp` and categorical column `event_type`. I need to pivot this data so each row represents a weekly interval and columns represent event counts per `event_type`. How do I handle the weekly date grouping directly inside the pivot structure? | pass→pass | 13,335 | 14,280 | +7% | 1 | 1 | 0% | 1,684 | 2,241 | +33% | 0 | 0 | — |
▸case-08 In an Excel workbook, end users frequently update the underlying table data, but the pivot table summary remains outdated until manual intervention. We want to ensure that whenever a user opens the workbook file, the pivot table automatically updates without requiring custom VBA code. Which standard setting achieves this? | pass→pass | 9,369 | 10,041 | +7% | 1 | 1 | 0% | 770 | 1,211 | +57% | 0 | 0 | — |
▸case-09 I received a wide formatted summary table DataFrame `df` with `department` as index and individual month columns (`Jan`, `Feb`, `Mar`). I need to transform this wide pivot layout back into a normalized long format with columns `department`, `month`, and `val` for database loading. What Pandas function performs this unpivoting? | pass→pass | 12,480 | 12,881 | +3% | 1 | 1 | 0% | 1,500 | 1,823 | +22% | 0 | 0 | — |
▸case-10 In Google BigQuery SQL, I have a table `web_traffic` with `channel`, `device`, and `sessions`. I want to use BigQuery's native `PIVOT` operator to turn `device` values ('mobile', 'desktop', 'tablet') into individual columns showing total sessions per channel. What is the query syntax? | pass→pass | 12,115 | 11,197 | -8% | 1 | 1 | 0% | 1,473 | 1,547 | +5% | 0 | 0 | — |
▸case-11 I have a performance log DataFrame `df` with columns `endpoint`, `region`, and `latency_ms`. I want to pivot this table with `endpoint` as rows and `region` as columns, but the summary metric must be the 90th percentile latency instead of standard mean or sum. How do I supply this custom metric to `pivot_table`? | pass→pass | 13,550 | 8,099 | -40% | 1 | 1 | 0% | 1,792 | 2,100 | +17% | 0 | 0 | — |
▸case-12 An Excel dashboard contains two separate pivot tables created from the same underlying dataset on separate worksheets. The user wants a single visual UI Slicer on the main dashboard to filter both pivot tables simultaneously. What configuration step connects the existing slicer to the second pivot table? | pass→pass | 9,192 | 10,900 | +19% | 1 | 1 | 0% | 814 | 1,290 | +58% | 0 | 0 | — |
▸case-13 I am working with a Rust-backed Python library, Polars, on a DataFrame `pl_df` containing `user_id`, `category`, and `amount`. I need to pivot `category` into columns and aggregate `amount` using sum per `user_id`. What is the syntax in Polars? | fail→fail | 13,339 | 8,249 | -38% | 1 | 1 | 0% | 1,688 | 2,021 | +20% | 0 | 0 | — |
▸case-14 In PostgreSQL, I need to create a matrix cross-tabulation of store sales across months using the official extension function provided by the `tablefunc` module rather than conditional CASE WHEN statements. Which function is used for this? | pass→pass | 5,520 | 11,206 | +103% | 1 | 1 | 0% | 1,062 | 1,549 | +46% | 0 | 0 | — |
▸case-15 I have a dataset with `region`, `year`, `quarter`, and `sales`. I want to pivot this in Pandas such that `region` is on rows, and the columns form a hierarchical MultiIndex with `year` at the top level and `quarter` nested underneath. How should the `columns` argument be structured? | pass→pass | 12,370 | 5,769 | -53% | 1 | 1 | 0% | 1,576 | 1,448 | -8% | 0 | 0 | — |
▸case-16 When creating an Excel pivot table over raw order logs, I need to summarize unique customer count per product category. Standard Excel pivot tables offer 'Count', but 'Distinct Count' is missing from the Summarize Values By list. How do I enable 'Distinct Count' support during pivot creation? | pass→pass | 12,057 | 12,155 | +1% | 1 | 1 | 0% | 1,258 | 1,556 | +24% | 0 | 0 | — |
▸case-17 I am constructing a summary pivot table in Pandas across store `location` and product `category`. Some categorical locations currently have zero matching activity in the raw dataset, but I need all locations present in categorical metadata to remain visible in the pivot index. Which parameter prevents dropping empty categorical rows? | pass→pass | 15,614 | 11,527 | -26% | 1 | 1 | 0% | 2,910 | 2,256 | -22% | 0 | 0 | — |
▸case-18 In Oracle Database 12c and above, I need to transform monthly transaction totals from table `financials` into separate columns for 'Jan', 'Feb', and 'Mar' using Oracle's native SQL pivot operator. What syntax structure is required? | pass→pass | 8,146 | 14,609 | +79% | 1 | 1 | 0% | 1,574 | 2,246 | +43% | 0 | 0 | — |
▸case-19 A developer attempts to reshapes a sales DataFrame `df` using `df.pivot(index='date', columns='store', values='sales')`, but it throws `ValueError: Index contains duplicate entries`. The goal is to aggregate duplicate date/store rows by sum. Why did `df.pivot` fail and what function should be used instead? | pass→pass | 6,355 | 5,825 | -8% | 1 | 1 | 0% | 1,218 | 1,473 | +21% | 0 | 0 | — |
▸case-20 We have a high-volume PostgreSQL table `user_events` with 50 million rows. Queries filtering by `user_id` and ordering by `created_at DESC` are taking several seconds. How should we write the DDL statement to create an efficient B-Tree index for this query pattern? | fail→pass | 9,233 | 12,002 | +30% | 1 | 1 | 0% | 1,742 | 1,579 | -9% | 0 | 0 | — |
▸case-21 We are evaluating an A/B test for a web page redesign. Group A has 1,200 conversions out of 10,000 visitors, and Group B has 1,350 conversions out of 10,000 visitors. I need Python code using `scipy.stats` or `statsmodels` to compute the two-sample z-test for proportions and obtain the p-value. How should this be written? | pass→pass | 16,926 | 14,652 | -13% | 1 | 1 | 0% | 2,686 | 2,519 | -6% | 0 | 0 | — |
▸case-22 I am styling a web application interface for an analytics dashboard. I need three metric KPI cards positioned in a single horizontal row, evenly distributing space between them, and wrapping onto a new line on narrow screen viewports. What pure CSS flexbox rules should be applied to the container? | pass→pass | 13,070 | 5,752 | -56% | 1 | 1 | 0% | 1,415 | 1,284 | -9% | 0 | 0 | — |