How to transform given dataset in python? : <pre><code>            1           0.0   6.400000000
            2   6.400000000          27.0
            2          27.0  27.100000000
            2  27.100000000  27.400000000
            2  27.400000000  27.700000000
            2  27.700000000  30.600000000
            1  30.600000000          31.0
            1          31.0  36.600000000
            1  36.600000000  36.900000000
            1  36.900000000  37.100000000
            1  37.100000000  37.100000000
            1  37.100000000  37.300000000
            1  37.300000000  37.800000000
            1  37.800000000  38.900000000
            1  38.900000000  39.200000000
            1  39.200000000  39.300000000
            1  39.300000000  39.500000000
            1  39.500000000  39.700000000
            2  39.700000000  42.600000000
            2  42.600000000  42.600000000
            2  42.600000000  42.800000000
            1  42.800000000  44.900000000
            1  44.900000000  45.600000000
            2  45.600000000          51.0
            1          51.0  51.800000000
</code></pre>

<pre><code>            1           0.0   6.400000000
            2   6.400000000  30.600000000
            1  30.600000000  39.500000000
... so on
</code></pre>

<p>I want to transform my data in the above format. I tried this with groupBy min and max for column but it seems like it doesn't give me the desirable results. </p>
