I am new in programming. I am trying to clean the data from a csv file for a further project extension. The csv file that is given as an input is really messy and I need its particular portions only.

Input File is as follows:
 [![enter image description here](https://i.stack.imgur.com/VjFTx.png)](https://i.stack.imgur.com/VjFTx.png)

Required Format: [![enter image description here](https://i.stack.imgur.com/YfLgl.png)](https://i.stack.imgur.com/YfLgl.png)

I am trying to extract the value for the 'OBSERVATION\_MODE', 'LON' and 'LAT' so far but I am not sure how to append the later values.
This is what I have tried so far:

```
import csv
import re

file = csv.reader(open('1mvn_kp_iuvs_2018_01_r01.tab.csv','r'))
mode = []
lat = []
for row in file:
    for values in row:
        if 'OBSERVATION_MODE' in values:
            print("\n")
            mode.append(row)

        if re.search('LAT', values):
            lat.append(row)

print(mode)
print(lat)

```

I am pretty sure the logic I am trying to work on is not at all useful. Can someone please give me a better overview of this ? I tried searching online too, but I found nothing to clean the data when the rows and columns both are mismatched. Any help is appreciated !

Thank You 

Link to the inut csv file and expected output is <https://drive.google.com/open?id=1LJxxbDcplSCPVWKnOC3usx7kZE8dS32H>

Please note that the expected output 'Cleaned\_sample.xlsx' is something I have manually generated and I want a similar output using python programming.