The data given is grouped by "latitude", it looks like this:
import pandas as pd
input_df = pd.DataFrame({"latitude": ["60", "", "", "", "70", "","80","","","","","85"],
"longitude": [50, 51, 52, 53, 50, 51,50,51,52,53,54,50],
"pollution": [10,20,30,40,50,60,70,80,90,100,110,120]
})
input_df
# see the input_df
latitude longitude pollution
0 60 50 10
1 51 20
2 52 30
3 53 40
4 70 50 50
5 51 60
6 80 50 70
7 51 80
8 52 90
9 53 100
10 54 110
11 85 50 120
Is there a way to fill the gaps in "latitude" columns? The desired output is:
latitude longitude pollution
0 60 50 10
1 60 51 20
2 60 52 30
3 60 53 40
4 70 50 50
5 70 51 60
6 80 50 70
7 80 51 80
8 80 52 90
9 80 53 100
10 80 54 110
11 85 50 120
Many thanks!