Skip to content

Instantly share code, notes, and snippets.

Avatar

Dillon Bordeleau Dleau

  • United States of America
View GitHub Profile
@Dleau
Dleau / csvify.py
Created Dec 18, 2019
csvify, JSON to CSV translation
View csvify.py
# 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 Dec 17, 2019
Split list into "chunks"
View split_into_chunks.py
# 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]
View keybase.md

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:

You can’t perform that action at this time.