<jupyter_start><jupyter_text><jupyter_code>%%time 

# Important library for many geopython libraries
!apt install gdal-bin python-gdal python3-gdal 
# Install rtree - Geopandas requirment
!apt install python3-rtree 
# Install Geopandas
!pip install git+git://github.com/geopandas/geopandas.git
# Install descartes - Geopandas requirment
!pip install descartes 
# Install Folium for Geographic data visualization
!pip install folium
# Install plotlyExpress
!pip install plotly_express
import sys

# If you're on Colab:
if 'google.colab' in sys.modules:
    DATA_PATH = 'https://raw.githubusercontent.com/LambdaSchool/DS-Unit-2-Kaggle-Challenge/master/data/'
    !pip install category_encoders==2.*
    !pip install pandas-profiling==2.*
import pandas as pd
import geopandas as gdp
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
test = pd.read_csv(DATA_PATH+'waterpumps/test_features.csv')
test.shape
gdf = gdp.GeoDataFrame(test, geometry=gdp.points_from_xy(test.longitude, test.latitude))
gdf.crs = {'init' :'epsg:4326'}
gdf.head()
gdf.shape
!pip install shapely
from shapely.geometry.polygon import Polygon
from shapely.geometry.multipolygon import MultiPolygon
!pip install PyShp
import fiona
import os
from zipfile import ZipFile

shapefile = gdp.read_file("/content/tza_tanzania_soil.zip")
print(shapefile)


sjoined_test = gdp.sjoin(gdf, shapefile, how='left', op='within')
sjoined_test.head(10)
sjoined_test.shape
sjoined_test.to_csv(r'/content/test_final.csv', index = False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09948979591836735, 'fraction_numerical': 0.00701530612244898, 'mean_word_length': 5.973333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '259540', 'license': 'MIT', 'n_tokens_mistral': 583, 'n_tokens_neox': 554, 'n_words': 130, 'path': 'Tan_GeoPandas_TestData_Merge.ipynb', 'repo_name': 'kvinne-anc/Tanzania-Soil-Topography-Waterpumps-Project', 'size': '1568'}