Skip to content

Instantly share code, notes, and snippets.

@knu2xs
knu2xs / enrichment-introspection.ipynb
Created May 28, 2021 15:12
Enrichment introspection examples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knu2xs
knu2xs / arcade_commute.arcade
Last active May 17, 2021 22:15
Arcade expression to calculate average drive time.
(
$feature.commute_ACSTWORKU5 * 2.5
+ $feature.commute_ACSTWORK5 * 7.0
+ $feature.commute_ACSTWORK10 * 12.0
+ $feature.commute_ACSTWORK15 * 17.0
+ $feature.commute_ACSTWORK20 * 22.0
+ $feature.commute_ACSTWORK25 * 27.0
+ $feature.commute_ACSTWORK30 * 32.0
+ $feature.commute_ACSTWORK35 * 37.0
+ $feature.commute_ACSTWORK40 * 42.0
@knu2xs
knu2xs / pyarrow-errors.ipynb
Created May 3, 2021 16:43
Errors encountered with PyArrow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knu2xs
knu2xs / enrich-direct-all.ipynb
Created April 27, 2021 22:43
Enrich block groups using all variables directly.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knu2xs
knu2xs / check_usgs_realtime.ipynb
Last active March 9, 2021 16:27
Check USGS realtime streamflow using Python.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knu2xs
knu2xs / io-spatial-methods.ipynb
Last active March 5, 2021 00:42
Example showing how to add all the pd.read_* and pd.DataFrame.to_* methods to the GeoAccessor with serialization and deserialization functioning.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knu2xs
knu2xs / snake_camel_conversion.py
Last active March 3, 2021 14:57
Convert names from camel to snake case and vice versa.
snk1_re = re.compile(r'(.)([A-Z][a-z]+)') # single capital preceded by any character and followed by lowercase
snk2_re = re.compile('([a-z0-9])([A-Z])') # single capital preceded by lowercase or numeral
def to_snake(name:str):
assert isinstance(name, str)
nm1 = snk1_re.sub(r'\1_\2', name)
nm2 = snk2_re.sub(r'\1_\2', nm1).lower()
return nm2
def to_camel(name:str):
@knu2xs
knu2xs / extent-polys-for-unique-values.ipynb
Created November 5, 2020 17:34
Generate a dataframe of extents as polygons for every unique value in a column of a feature service.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.