Skip to main content

turn a geodataframe of points into mountains, scaled by a data attribute associated with each point

Project description

data-mountains

# requirements

import pandas as pd
import geopandas as gpd
from shapely.geometry import Polygon, Point, LineString, GeometryCollection
from shapely.ops import unary_union, transform
import altair as alt
import math
import matplotlib.pyplot as plt

Install

pip install data_mountains

How to use

# import the library
import data_mountains.mountainise as dm

# some census output area population density data
popden_oa = pd.read_csv('https://gist.github.com/joel-lbth/b35c0ac7a3652c3f34441d25c45ea84a/raw/d69075dc707b5bdb06c9b640d43db1e5b2ffcb64/lbth_census_2021_pop_density_oa.csv')

# some census output area population weighted centroids
oa = gpd.read_file("https://gist.github.com/joel-lbth/00f24602797d51d02d2177ed82f9295d/raw/b6c26621504a0df20ef6db1c93e5f99bce911d0a/lbth_oa21_pop_centroids.geojson")

# add data attribute to each point by merging on common identifier
gdf = oa.merge(popden_oa, left_on='oa21cd', right_on='GEOGRAPHY_CODE')

# turn each point in a data sized mountain
gdf = dm.points_to_peaks(gdf=gdf, column='OBS_VALUE', range=[0, 0.01])
# use Altair to create the visual
dm.plot(gdf=gdf, fill='#eee', stroke='#333')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data-mountains-0.0.5.tar.gz (70.1 kB view details)

Uploaded Source

Built Distribution

data_mountains-0.0.5-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file data-mountains-0.0.5.tar.gz.

File metadata

  • Download URL: data-mountains-0.0.5.tar.gz
  • Upload date:
  • Size: 70.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for data-mountains-0.0.5.tar.gz
Algorithm Hash digest
SHA256 539d9c80d6201958c86d30919c2c01148e2e85d78f8c1d3fa8a36dc010849b61
MD5 c0da55f843704c6ddafb7bef088a26ff
BLAKE2b-256 ad53b9ac7cda6713742bec1348e1b3157ee0ce8f130d0d7a8e240d3697341be2

See more details on using hashes here.

File details

Details for the file data_mountains-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for data_mountains-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9305ca6e7579295e6b0bce9edb136f1c0129eeea998a1dfbd5c160ef7092802d
MD5 56c16e5edae2b6c9eb58a8e10d8e9572
BLAKE2b-256 ebfbcd88bf0decdccf70b5eacd583fc4ec69e520561264615286cb377497b277

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page