Skip to content

Instantly share code, notes, and snippets.

View akariv's full-sized avatar
🔧
Wrangling data for the common good

Adam Kariv akariv

🔧
Wrangling data for the common good
View GitHub Profile
@akariv
akariv / mohammad-exercise-1.py
Created October 11, 2020 18:56
googleplaystore dataflows execrsie
from dataflows import Flow, load, filter_rows, join_with_self, set_type, concatenate, dump_to_path, printer
Flow(
load('googleplaystore.xlsx'),
filter_rows(
equals=[dict(Price=0)],
),
filter_rows(
not_equals=[dict(Rating='NaN')],
),
@akariv
akariv / dump_old_db.py
Last active July 4, 2018 09:24
Backs up an OpenSpending DB based on the contents of the package registry
import os
import subprocess
import json
import shutil
def run(cmd):
return subprocess.check_output(cmd, shell=True).decode('utf8').strip()
def remotecmd(pod, cmd):
return '''kubectl exec -n production {} -- {}'''.format(pod, cmd)
formatNumber = function(n,decimals) {
var s, remainder, num, negativePrefix, negativeSuffix, prefix, suffix;
suffix = ""
negativePrefix = ""
negativeSuffix = ""
if (n < 0) {
negativePrefix = "";
negativeSuffix = " in income"
n = -n
};
budget_array_data = [{"budget_0": 80832, "budget_1": 99801, "name": "\u05ea\u05d0\u05d5\u05dd \u05d4\u05e4\u05e2\u05d5\u05dc\u05d5\u05ea \u05d1\u05e9\u05d8\u05d7\u05d9\u05dd", "department": "\u05ea\u05d0\u05d5\u05dd \u05d4\u05e4\u05e2\u05d5\u05dc\u05d5\u05ea \u05d1\u05e9\u05d8\u05d7\u05d9\u05dd", "id": 17, "change": 0.23467191211401417}, {"budget_0": 204074, "budget_1": 248439, "name": "\u05d4\u05d5\u05e6\u05d0\u05d5\u05ea \u05d7\u05e8\u05d5\u05dd \u05d0\u05d6\u05e8\u05d7\u05d9\u05d5\u05ea", "department": "\u05d4\u05d5\u05e6\u05d0\u05d5\u05ea \u05d7\u05e8\u05d5\u05dd \u05d0\u05d6\u05e8\u05d7\u05d9\u05d5\u05ea", "id": 16, "change": 0.21739663063398562}, {"budget_0": 50352073, "budget_1": 51466939, "name": "\u05de\u05e9\u05e8\u05d3 \u05d4\u05d1\u05d8\u05d7\u05d5\u05df", "department": "\u05de\u05e9\u05e8\u05d3 \u05d4\u05d1\u05d8\u05d7\u05d5\u05df", "id": 15, "change": 0.02214141213212817}, {"budget_0": 137737, "budget_1": 384487, "name": "\u05de\u05d9\u05de\u05d5\u05df \u05de\u05e4\u05dc\u05d2\u05d5\u05ea", "dep