Here's a list
- of
- pointless
- stuff
Now go home
import geopandas as gpd | |
import pandas as pd | |
england = pd.read_csv("https://raw.githubusercontent.com/jamesdamillington/spar/main/data/brexit/brexit_vote.csv", | |
index_col='Area_Code') | |
lads = gpd.read_file("https://raw.githubusercontent.com/jamesdamillington/spar/main/data/brexit/local_authority_districts.geojson").set_index('lad16cd') | |
Egdf = lads.merge(england, how='inner', | |
left_index=True, right_index=True) |
#import rquired packages | |
import pandas as pd | |
import geopandas as gpd | |
from shapely.geometry import Point | |
#read data and check column names (for coords) | |
df = pd.read_csv("data/StationLocationIGS.csv") | |
df.columns | |
#create geometry column from lat and long using shapely |
#when saving GeoDataFrames as csv, high precision geometries can produce large files on disk | |
#reducing unnecessary precision can help reduce file size | |
#e.g. ONS digital vector boundary data converted from shp to gpd results in nano-metre precision! | |
import geopandas as gpd | |
from shapely.wkt import loads | |
from shapely.wkt import dumps | |
#set desired number of decimal places (e.g. see https://xkcd.com/2170/) | |
precision = 0 |
#import relevant packages | |
import pandas as pd | |
import geopandas as gpd | |
from shapely.wkt import loads | |
#set variables for this particular data set | |
file_path = "data/mydata.csv" #location of data | |
geom_col = 'geometry' #name of column containing geometries | |
epsg_id = 27700 #see https://epsg.io/ | |
crs_str = "EPSG:" + str(epsg_id) #concat |
Here's a list
Now go home