{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"d91b818f-33dd-299d-6d18-49780d5204d2"},"outputs":[],"source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport shapely.wkt\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nlabels = pd.read_csv('../input/train_wkt_v4.csv')\n\nbroken = []\nfor i, row in labels.iterrows():\n    polys = shapely.wkt.loads(row[2])\n    for j, poly in enumerate(polys):\n        if not poly.is_valid:\n            break\n\nlist(polys.geoms), poly"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"94a122d4-eb39-4ab5-e946-8d7b998d41ea"},"outputs":[],"source":"fixed = broken[0][2].buffer(0)\nfixed.is_valid\n\n"}],"metadata":{"_change_revision":0,"_is_fork":false,"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.0"}},"nbformat":4,"nbformat_minor":0}