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:
| State          | PVI   | Incumbent               | Last race   | Cook June 22, 2017   | Roth. Apr. 21 2017   | Sabato May 17, 2017   |
|:---------------|:------|:------------------------|:------------|:---------------------|:---------------------|:----------------------|
| Alabama        | R+14  | Kay Ivey (R)            | 63.6% R     | Safe R               | Safe R               | Safe R                |
| Alaska         | R+9   | Bill Walker (I)         | 48.1% I     | Tossup               | Lean I               | Tossup                |
| Arizona        | R+5   | Doug Ducey (R)          | 53.4% R     | Likely R             | Likely R             | Likely R              |
| Arkansas       | R+15  | Asa Hutchinson (R)      | 55.4% R     | Safe R               | Safe R               | Safe R                |
| California     | D+12  | (Jerry Brown) (D)       | 60.0% D     | Safe D               | Safe D               | Safe D                |
| Colorado       | D+1   | (John Hickenlooper) (D) | 48.4% D     | Lean D               | Lean D               | Tossup                |
| Connecticut    | D+6   | (Dan Malloy) (D)        | 50.9% D     | Tossup               | Lean D               | Tossup                |
| Florida        | R+2   | (Rick Scott) (R)        | 48.2% R     | Tossup               | Tossup               | Tossup                |
| Georgia        | R+5   | (Nathan Deal) (R)       | 52.8% R     | Safe R               | Likely R             | Likely R              |
| Hawaii         | D+18  | David Ige (D)           | 49.0% D     | Safe D               | Safe D               | Safe D                |
| Idaho          | R+19  | (Butch Otter) (R)       | 53.5% R     | Safe R               | Safe R               | Safe R                |
| Illinois       | D+7   | Bruce Rauner (R)        | 50.3% R     | Tossup               | Tilt D               | Tossup                |
| Iowa           | R+3   | Kim Reynolds (R)        | 59.0% R     | Safe R               | Lean R               | Lean R                |
| Kansas         | R+13  | (Sam Brownback) (R)     | 49.8% R     | Likely R             | Likely R             | Lean R                |
| Maine          | D+3   | (Paul LePage) (R)       | 48.2% R     | Tossup               | Lean D               | Tossup                |
| Maryland       | D+12  | Larry Hogan (R)         | 51.0% R     | Likely R             | Likely R             | Lean R                |
| Massachusetts  | D+12  | Charlie Baker (R)       | 48.5% R     | Likely R             | Safe R               | Lean R                |
| Michigan       | D+1   | (Rick Snyder) (R)       | 50.9% R     | Tossup               | Tossup               | Tossup                |
| Minnesota      | D+1   | (Mark Dayton) (D)       | 50.1% D     | Tossup               | Safe D               | Tossup                |
| Nebraska       | R+14  | Pete Ricketts (R)       | 57.2% R     | Safe R               | Safe R               | Safe R                |
| Nevada         | D+1   | (Brian Sandoval) (R)    | 70.6% R     | Tossup               | Tossup               | Tossup                |
| New Hampshire  | EVEN  | Chris Sununu (R)        | 48.8% R     | Lean R               | Lean R               | Lean R                |
| New Mexico     | D+3   | (Susana Martinez) (R)   | 57.3% R     | Lean D               | Lean D               | Lean D                |
| New York       | D+11  | Andrew Cuomo (D)        | 54.2% D     | Safe D               | Safe D               | Safe D                |
| Ohio           | R+3   | (John Kasich) (R)       | 63.8% R     | Lean R               | Tilt R               | Lean R                |
| Oklahoma       | R+20  | (Mary Fallin) (R)       | 55.8% R     | Safe R               | Likely R             | Likely R              |
| Oregon         | D+5   | Kate Brown (D)          | 50.9% D     | Likely D             | Safe D               | Likely D              |
| Pennsylvania   | EVEN  | Tom Wolf (D)            | 54.9% D     | Lean D               | Lean D               | Lean D                |
| Rhode Island   | D+10  | Gina Raimondo (D)       | 40.7% D     | Likely D             | Safe D               | Lean D                |
| South Carolina | R+8   | Henry McMaster (R)      | 55.9% R     | Safe R               | Safe R               | Safe R                |
| South Dakota   | R+14  | (Dennis Daugaard) (R)   | 70.5% R     | Safe R               | Safe R               | Safe R                |
| Tennessee      | R+14  | (Bill Haslam) (R)       | 70.3% R     | Likely R             | Likely R             | Likely R              |
| Texas          | R+8   | Greg Abbott (R)         | 59.3% R     | Safe R               | Safe R               | Safe R                |
| Vermont        | D+15  | Phil Scott (R)          | 52.9% R     | Likely R             | Safe R               | Likely R              |
| Wisconsin      | EVEN  | Scott Walker (R)        | 52.3% R     | Lean R               | Likely R             | Lean R                |
| Wyoming        | R+25  | (Matt Mead) (R)         | 58.3% R     | Safe R               | Safe R               | Safe R                |

## Output:


source: web
label: operator: stack
stack_start_idx: 4
stack_end_idx: 6