Skip to content

Instantly share code, notes, and snippets.

View Dleau's full-sized avatar

Dillon Bordeleau Dleau

  • United States of America
View GitHub Profile
@Dleau
Dleau / csvify.py
Created December 18, 2019 03:53
csvify, JSON to CSV translation
# recursively traverse a dictionary, concatenate key names,
# then map those names to values
# extremely useful in JSON to CSV translation
def helper(d, path=[]):
if isinstance(d, dict):
for root, child in d.items():
yield from helper(child, path + [root])
else: yield path + [d]
@Dleau
Dleau / split_into_chunks.py
Created December 17, 2019 04:10
Split list into "chunks"
# split list l into c "chunks"
def split_into_chunks(l, c):
chunks = []
for i in range(0, c):
chunks.append([])
for i, e in enumerate(l):
chunks[i % c].append(e)
return chunks
l = [1, 2, 3, 4, 5, 6]

Keybase proof

I hereby claim:

  • I am dleau on github.
  • I am deltabravo (https://keybase.io/deltabravo) on keybase.
  • I have a public key ASDyNR5FnuatZYRI0loECuYDwS8XsVmahTDb3mrwulvXVQo

To claim this, I am signing this object: