Premium problem54. Minesweeper: Reshape to Grid

Hard Locked

Reshape the Minesweeper df into a grid of the adjacent counts: one row per y coordinate, one column per x coordinate, with cell (y, x) holding that square's adjacent-mine count. Drop the mine column first. Return a DataFrame indexed by y, with columns labeled by x under the original adjacent column name.

Input

   x  y  mine  adjacent
0  0  0     0       1.0
1  0  1     1       2.0
2  1  0     0       3.0
3  1  1     1       1.0

Output

  adjacent     
x        0    1
y              
0      1.0  3.0
1      2.0  1.0

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)