<jupyter_start><jupyter_text>Read GeojSon from csv<jupyter_code>import pandas as pd
import geopandas as gpd
import json
from shapely.geometry import MultiPoint<jupyter_output><empty_output><jupyter_text>Read CSV using pandas and explore the dataset<jupyter_code>df = pd.read_csv('csv/technologies_clean.csv', delimiter=';')
df<jupyter_output><empty_output><jupyter_text>Define a function to read string geometries and transform into shapely objects<jupyter_code>def multipoint(geojson):
    
    try:
        feature_collection = json.loads(geojson)

        # Fix properties element, remove null for dict
        for feature in feature_collection['features']:
            feature['properties'] = {}
    
        return MultiPoint(points=gpd.GeoDataFrame.from_features(feature_collection).geometry)
    
    except Exception as e:
        print(e)
        return<jupyter_output><empty_output><jupyter_text>Replace previous geometry applying previous function<jupyter_code>df['geometry'] = df['geometry'].apply(multipoint)<jupyter_output><empty_output><jupyter_text>Create a geodataframe and write it<jupyter_code>gdf = gpd.GeoDataFrame(data=df, geometry=df.geometry, crs='EPSG:4326')
gdf = gdf.set_crs('EPSG:4326')
gdf
# Save raw shapefile
gdf.to_file(driver='ESRI Shapefile', filename='shp/technologies_clean.shp')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09962825278810408, 'fraction_numerical': 0.005947955390334572, 'mean_word_length': 5.974093264248705, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '562159', 'license': 'MIT', 'n_tokens_mistral': 458, 'n_tokens_neox': 441, 'n_words': 85, 'path': 'read_geojson.ipynb', 'repo_name': 'ingdanielguerrero/scripts', 'size': '1345'}