Skip to content

Instantly share code, notes, and snippets.

View janbenetka's full-sized avatar

Jan Benetka janbenetka

  • Unacast
  • Pilsen, Czech Republic
View GitHub Profile
@janbenetka
janbenetka / SettingwithCopyWarning.py
Last active October 14, 2020 17:43
[SettingwithCopyWarning] Pandas complaining SettingwithCopyWarning #python #pandas #errors
pd.set_option('mode.chained_assignment', None)
@janbenetka
janbenetka / cartoframes_plot_polygons.py
Last active September 23, 2020 21:22
[Cartoframes plot ploygons with points] #carto #python
from cartoframes.viz import Map, Layer, basemaps
from cartoframes.viz import Layer, color_continuous_style, color_bins_style, basic_style, color_category_legend
_df = average_duration.copy()
metric = 'avg_duration_day'
origin_county = selected_area_geom.iloc[0]['county_name']
origin_state = selected_area_geom.iloc[0]['state_name']
@janbenetka
janbenetka / bq_array_to_string
Created September 23, 2020 14:58
BigQuery - unpacking array to string #bigquery
ARRAY_TO_STRING(homeContext.fipscode, ',')
@janbenetka
janbenetka / leading_zero.sql
Created August 23, 2020 17:31
[Add leading zeros in BigQuery] #leading_zero #bigquery
SUBSTR(FORMAT("00%d", state_fips ), -2) as state_fips,
SUBSTR(FORMAT("00000%d", fips ), -5) as fips,
@janbenetka
janbenetka / pandas_isin_in_query.py
Created August 13, 2020 22:51
[Query with list comparison ala .isin()] #pandas #query
df.query('a in ["a", "b", "c"]')
id_list = ["a", "b", "c"]
df.query('a in @id_list')
@janbenetka
janbenetka / colors_css_named.py
Created August 11, 2020 14:18
[Named colors] Default colors that have name in CSS. #python #color #css
colors = ['aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure',
'beige', 'bisque', 'black', 'blanchedalmond', 'blue',
'blueviolet', 'brown', 'burlywood', 'cadetblue',
'chartreuse', 'chocolate', 'coral', 'cornflowerblue',
'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan',
'darkgoldenrod', 'darkgray', 'darkgrey', 'darkgreen',
'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange',
'darkorchid', 'darkred', 'darksalmon', 'darkseagreen',
'darkslateblue', 'darkslategray', 'darkslategrey',
'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue',