In [1]:
import pandas as pd
import numpy as np
from shapely import wkt

In [2]:
subm_name = 'debug_subm_16x16.csv'

In [3]:
subm1 = pd.read_csv(subm_name)

In [4]:
def make_index(sub):
    sub['key'] = sub.apply(lambda x: x[0]+str(x[1]), axis=1)
    sub = sub.set_index('key', drop=True)
    return sub

In [5]:
subm1 = make_index(subm1)

In [6]:
# for simplicity just remove the multipolygons with net topology errors.
subm1.loc['6100_0_22', 'MultipolygonWKT'] = 'MULTIPOLYGON EMPTY'
subm1.loc['6060_1_42', 'MultipolygonWKT'] = 'MULTIPOLYGON EMPTY'

In [7]:
subm1.loc['6100_0_22']


Out[7]:
ImageId                      6100_0_2
ClassType                           2
MultipolygonWKT    MULTIPOLYGON EMPTY
Name: 6100_0_22, dtype: object

In [8]:
subm1.loc['6060_1_42']


Out[8]:
ImageId                      6060_1_4
ClassType                           2
MultipolygonWKT    MULTIPOLYGON EMPTY
Name: 6060_1_42, dtype: object

In [9]:
subm1 = subm1.set_index('ImageId', drop=True)

In [10]:
subm1.to_csv('fixed_' + subm_name)

In [ ]: