Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am alexandrakapp on github.
  • I am lxndrkp (https://keybase.io/lxndrkp) on keybase.
  • I have a public key ASCopZ4j7uQl1baFtmohzoVTx-LgAMOXRbCJMyf2tMTcdgo

To claim this, I am signing this object:

@AlexandraKapp
AlexandraKapp / berlin-s-bahn-ring.geojson
Created August 1, 2019 12:21 — forked from derhuerst/berlin-s-bahn-ring.geojson
Berliner S-Bahn-Ring GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

How to setup a geocoder api on your local computer

  1. Setup docker on your local machine and install Docker desktop
  2. Clone the nominitim-docker v3.0.0 repo:
git clone https://github.com/mediagis/nominatim-docker/tree/master/3.0

​ 3. Modify the Dockerfile and set your url to PBF

add paths to .bashsrc

echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/' >> ~/.bashrc

show hidden files

ls -la ~/ | more
@AlexandraKapp
AlexandraKapp / data_to_plr.py
Created September 23, 2019 13:55
Merge data with Berlin Planungsraeume
import geopandas as gpd
import pandas as pd
from shapely.geometry import Point
plr = gpd.read_file('data/lor_planungsraeume.geojson', encoding='utf-8')
df = pd.read_csv('data/DATAFILE.csv', sep=";", dtype={'PLR_CODES':str}, na_values=['OTHER_NAN_VALUES'])
df.set_index('PLR_CODES', inplace=True)
data = df.join(plr.set_index('spatial_name'), rsuffix='_r')
@AlexandraKapp
AlexandraKapp / pypi_package.md
Last active October 9, 2019 21:14
Upload Package to PyPI

Upload Package to PyPI

  1. create package distribution python setup.py sdist bdist_wheel

  2. Test if Package is without errors twine check dist/*

  3. upload package python -m twine upload dist/*

merge two dfs on specific key

df.set_index('key').join(df2.set_index('key'))

get datetime from String

pd.to_datetime(df['date'],format='%Y-%m-%d')

get weekday of datetime

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Jupyter Lab commands

execute command line in cell with !:

! pip freeze