Task: Data-transform-reshape (source dataset: Auto-Tables)

Given a table, predict what python pandas transformation may be needed on the given input table. Valid choices for transformation include: {"stack", "wide_to_long", "transpose", "pivot", "explode", "ffill", "subtitles"}. Note that each of these is a common Python Pandas operator. Some transformations can have parameters. Each transformation and its parameters are describe as follows.
 
- stack: collapse homogeneous cols into rows.
@param (int): stack_start_idx: zero-based starting column index of the homogeneous column-group.
@param (int): stack_end_idx: zero-based ending column index of the homogeneous column-group.
 
- wide_to_long: collapse repeating col-groups into rows.
@param (int): wide_to_long_start_idx: zero-based starting column index of the repeating col-groups.
@param (int): wide_to_long_end_idx: zero-based ending column index of the repeating col-groups.
 
- transpose: convert rows to columns and vice versa.
 
- pivot: pivot repeating row-groups into cols.
@param (int): pivot_row_frequency: frequency of repeating row-groups.
 
- ffill: fill structurally empty cells in tables.
@param (int): ffill_end_idx: zero-based ending column index of the columns to be filled.
 
- explode: convert composite cells into atomic values
@param (int): explode_column_idx: zero-based column index of the column to be exploded.
 
- subtitle: convert table subtitles into a column.
 
OUTPUT the predicted transformation name along with its parameters for the given INPUT table in a JSON, e.g., {"transformation": "stack", "stack_start_idx": 1, "stack_end_idx": 5}. If the input table needs multi-step transformations (e.g, ffill followed by stack), list JSON of each transformation sequentially in a list, e.g., [{"transformation": "ffill", "ffill_end_idx": 1}, {"transformation": "stack", "stack_start_idx": 1, "stack_end_idx": 5}]. No explanation is needed.

## Input:
| District          | 2017 CPVI   | Incumbent                 |   First elected | 2016 result   | Cook July 7, 2017   | Roth. July 7, 2017   | Sab. June 21, 2017   |
|:------------------|:------------|:--------------------------|----------------:|:--------------|:--------------------|:---------------------|:---------------------|
| Alaska at-large   | R+9         | Don Young (R)             |            1972 | 50.3% R       | Safe R              | Safe R               | Likely R             |
| Arizona 1         | R+2         | Tom O'Halleran (D)        |            2016 | 50.7% D       | Leans D             | Tossup               | Leans D              |
| Arizona 2         | R+1         | Martha McSally (R)        |            2014 | 57.0% R       | Leans R             | Leans R              | Leans R              |
| California 7      | D+3         | Ami Bera (D)              |            2012 | 51.2% D       | Leans D             | Likely D             | Leans D              |
| California 10     | EVEN        | Jeff Denham (R)           |            2010 | 51.7% R       | Leans R             | Leans R              | Tossup               |
| California 16     | D+9         | Jim Costa (D)             |            2004 | 58.0% D       | Safe D              | Safe D               | Likely D             |
| California 21     | D+5         | David Valadao (R)         |            2012 | 56.7% R       | Likely R            | Likely R             | Likely R             |
| California 24     | D+7         | Salud Carbajal (D)        |            2016 | 53.4% D       | Likely D            | Likely D             | Likely D             |
| California 25     | EVEN        | Steve Knight (R)          |            2014 | 53.1% R       | Tossup              | Leans R              | Tossup               |
| California 39     | EVEN        | Ed Royce (R)              |            1992 | 57.2% R       | Leans R             | Leans R              | Likely R             |
| California 45     | R+3         | Mimi Walters (R)          |            2014 | 58.6% R       | Leans R             | Likely R             | Likely R             |
| California 48     | R+4         | Dana Rohrabacher (R)      |            1988 | 58.3% R       | Leans R             | Leans R              | Leans R              |
| California 49     | R+1         | Darrell Issa (R)          |            2000 | 50.3% R       | Tossup              | Tossup               | Tossup               |
| California 50     | R+11        | Duncan D. Hunter (R)      |            2008 | 63.5% R       | Safe R              | Likely R             | Safe R               |
| Colorado 6        | D+2         | Mike Coffman (R)          |            2008 | 50.9% R       | Tossup              | Tilt R               | Tossup               |
| Florida 7         | EVEN        | Stephanie Murphy (D)      |            2016 | 51.5% D       | Leans D             | Tilt D               | Leans D              |
| Florida 13        | D+2         | Charlie Crist (D)         |            2016 | 51.9% D       | Likely D            | Leans D              | Leans D              |
| Florida 18        | R+5         | Brian Mast (R)            |            2016 | 53.6% R       | Likely R            | Safe R               | Likely R             |
| Florida 25        | R+4         | Mario Diaz-Balart (R)     |            2002 | 62.4% R       | Safe R              | Safe R               | Likely R             |
| Florida 26        | D+6         | Carlos Curbelo (R)        |            2014 | 53.0% R       | Leans R             | Tilt R               | Tossup               |
| Florida 27        | D+5         | (Ileana Ros-Lehtinen) (R) |            1989 | 54.9% R       | Leans D             | Leans D              | Leans D              |
| Georgia 6         | R+8         | Karen Handel (R)          |            2017 | 51.9% R       | Leans R             | Leans R              | Leans R              |
| Georgia 7         | R+9         | Rob Woodall (R)           |            2010 | 60.4% R       | Likely R            | Safe R               | Safe R               |
| Illinois 6        | R+2         | Peter Roskam (R)          |            2006 | 59.2% R       | Leans R             | Likely R             | Likely R             |
| Illinois 10       | D+10        | Brad Schneider (D)        |            2016 | 52.6% D       | Safe D              | Safe D               | Likely D             |
| Illinois 12       | R+5         | Mike Bost (R)             |            2014 | 54.3% R       | Leans R             | Likely R             | Safe R               |
| Illinois 13       | R+3         | Rodney Davis (R)          |            2014 | 59.7% R       | Likely R            | Likely R             | Likely R             |
| Illinois 14       | R+5         | Randy Hultgren (R)        |            2010 | 59.3% R       | Likely R            | Safe R               | Likely R             |
| Illinois 17       | D+3         | Cheri Bustos (D)          |            2012 | 60.3% D       | Safe D              | Safe D               | Likely D             |
| Iowa 1            | D+1         | Rod Blum (R)              |            2014 | 53.7% R       | Leans R             | Leans R              | Leans R              |
| Iowa 2            | D+1         | Dave Loebsack (D)         |            2006 | 53.7% D       | Likely D            | Likely D             | Likely D             |
| Iowa 3            | R+1         | David Young (R)           |            2014 | 53.5% R       | Leans R             | Likely R             | Leans R              |
| Kansas 2          | R+10        | (Lynn Jenkins) (R)        |            2008 | 60.9% R       | Likely R            | Likely R             | Likely R             |
| Kansas 3          | R+4         | Kevin Yoder (R)           |            2010 | 51.3% R       | Leans R             | Leans R              | Leans R              |
| Maine 2           | R+2         | Bruce Poliquin (R)        |            2014 | 54.8% R       | Likely R            | Likely R             | Leans R              |
| Michigan 8        | R+4         | Mike Bishop (R)           |            2014 | 56.0% R       | Likely R            | Likely R             | Likely R             |
| Michigan 11       | R+4         | Dave Trott (R)            |            2014 | 52.9% R       | Likely R            | Likely R             | Likely R             |
| Minnesota 1       | R+5         | (Tim Walz) (D)            |            2006 | 50.3% D       | Tossup              | Tossup               | Tossup               |
| Minnesota 2       | R+2         | Jason Lewis (R)           |            2016 | 47.0% R       | Tossup              | Tossup               | Tossup               |
| Minnesota 3       | D+1         | Erik Paulsen (R)          |            2008 | 56.7% R       | Leans R             | Leans R              | Leans R              |
| Minnesota 7       | R+12        | Collin Peterson (D)       |            1990 | 52.5% D       | Likely D            | Leans D              | Likely D             |
| Minnesota 8       | R+4         | Rick Nolan (D)            |            2012 | 50.2% D       | Leans D             | Leans D              | Leans D              |
| Montana at-large  | R+11        | Greg Gianforte (R)        |            2017 | 50.0% R       | Likely R            | Leans R              | Leans R              |
| Nebraska 2        | R+4         | Don Bacon (R)             |            2016 | 48.9% R       | Tossup              | Leans R              | Tossup               |
| Nevada 3          | R+2         | (Jacky Rosen) (D)         |            2016 | 47.2% D       | Tossup              | Tilt D               | Leans D              |
| Nevada 4          | D+3         | Ruben Kihuen (D)          |            2016 | 48.5% D       | Leans D             | Safe D               | Likely D             |
| New Hampshire 1   | R+2         | Carol Shea-Porter (D)     |            2016 | 44.3% D       | Tossup              | Tilt D               | Tossup               |
| New Hampshire 2   | D+2         | Ann McLane Kuster (D)     |            2012 | 49.8% D       | Likely D            | Safe D               | Likely D             |
| New Jersey 3      | R+2         | Tom MacArthur (R)         |            2014 | 59.3% R       | Likely R            | Safe R               | Likely R             |
| New Jersey 5      | R+3         | Josh Gottheimer (D)       |            2016 | 51.1% D       | Leans D             | Tossup               | Leans D              |
| New Jersey 7      | R+3         | Leonard Lance (R)         |            2008 | 54.1% R       | Leans R             | Likely R             | Likely R             |
| New Jersey 11     | R+3         | Rodney Frelinghuysen (R)  |            1994 | 58.0% R       | Leans R             | Likely R             | Likely R             |
| New York 1        | R+5         | Lee Zeldin (R)            |            2016 | 58.2% R       | Likely R            | Safe R               | Likely R             |
| New York 3        | D+1         | Thomas Suozzi (D)         |            2016 | 53.0% D       | Likely D            | Safe D               | Likely D             |
| New York 18       | R+1         | Sean Patrick Maloney (D)  |            2012 | 55.6% D       | Likely D            | Safe D               | Likely D             |
| New York 19       | R+2         | John Faso (R)             |            2016 | 54.0% R       | Tossup              | Tilt R               | Leans R              |
| New York 22       | R+6         | Claudia Tenney (R)        |            2016 | 46.5% R       | Leans R             | Leans R              | Likely R             |
| New York 23       | R+6         | Tom Reed (R)              |            2010 | 57.6% R       | Safe R              | Safe R               | Likely R             |
| New York 24       | D+3         | John Katko (R)            |            2014 | 60.5% R       | Likely R            | Likely R             | Likely R             |
| North Carolina 9  | R+8         | Robert Pittenger (R)      |            2012 | 51.8% R       | Likely R            | Safe R               | Safe R               |
| North Carolina 13 | R+6         | Ted Budd (R)              |            2016 | 56.1% R       | Likely R            | Safe R               | Safe R               |
| Ohio 1            | R+5         | Steve Chabot (R)          |            2010 | 59.2% R       | Likely R            | Safe R               | Likely R             |
| Ohio 16           | R+8         | (Jim Renacci) (R)         |            2010 | 65.3% R       | Likely R            | Safe R               | Safe R               |
| Oregon 5          | EVEN        | Kurt Schrader (D)         |            2008 | 53.5% D       | Likely D            | Safe D               | Safe D               |
| Pennsylvania 6    | R+2         | Ryan Costello (R)         |            2014 | 57.2% R       | Leans R             | Likely R             | Likely R             |
| Pennsylvania 7    | R+1         | Pat Meehan (R)            |            2010 | 59.5% R       | Likely R            | Likely R             | Likely R             |
| Pennsylvania 8    | R+2         | Brian Fitzpatrick (R)     |            2016 | 54.4% R       | Leans R             | Leans R              | Leans R              |
| Pennsylvania 16   | R+5         | Lloyd Smucker (R)         |            2016 | 53.8% R       | Likely R            | Leans R              | Likely R             |
| Pennsylvania 17   | R+1         | Matt Cartwright (D)       |            2012 | 53.8% D       | Likely D            | Likely D             | Likely D             |
| Texas 7           | R+7         | John Culberson (R)        |            2000 | 56.2% R       | Leans R             | Likely R             | Likely R             |
| Texas 23          | R+1         | Will Hurd (R)             |            2014 | 48.3% R       | Leans R             | Tossup               | Tossup               |
| Texas 32          | R+5         | Pete Sessions (R)         |            1996 | 71.1% R       | Leans R             | Likely R             | Likely R             |
| Utah 4            | R+13        | Mia Love (R)              |            2014 | 53.8% R       | Safe R              | Safe R               | Likely R             |
| Virginia 2        | R+3         | Scott Taylor (R)          |            2016 | 61.3% R       | Likely R            | Safe R               | Safe R               |
| Virginia 5        | R+6         | Tom Garrett (R)           |            2016 | 58.2% R       | Likely R            | Safe R               | Safe R               |
| Virginia 10       | D+1         | Barbara Comstock (R)      |            2014 | 52.7% R       | Tossup              | Tilt R               | Tossup               |
| Washington 8      | EVEN        | Dave Reichert (R)         |            2004 | 60.2% R       | Likely R            | Safe R               | Likely R             |
| West Virginia 3   | R+23        | (Evan Jenkins) (R)        |            2014 | 67.9% R       | Safe R              | Safe R               | Likely R             |
| Wisconsin 3       | EVEN        | Ron Kind (D)              |            1996 | 98.9% D       | Likely D            | Likely D             | Likely D             |

## Output:


source: web
label: operator: stack
stack_start_idx: 5
stack_end_idx: 7