summaryrefslogtreecommitdiff
path: root/check-counts.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-11-25 22:19:15 +0100
committerJules Laplace <julescarbon@gmail.com>2018-11-25 22:19:15 +0100
commitee3d0d98e19f1d8177d85af1866fd0ee431fe9ea (patch)
tree41372528e78d4328bc2a47bbbabac7e809c58894 /check-counts.py
parent255b8178af1e25a71fd23703d30c0d1f74911f47 (diff)
moving stuff
Diffstat (limited to 'check-counts.py')
-rw-r--r--check-counts.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/check-counts.py b/check-counts.py
deleted file mode 100644
index 4fed4494..00000000
--- a/check-counts.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import os
-import sys
-import csv
-from math import ceil
-import subprocess
-import random
-
-import click
-
-@click.command()
-def check_counts():
- """Split a CSV into groups."""
- mypath = './datasets/scholar/entries/'
- onlyfiles = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f))]
- recs = []
- for f in onlyfiles:
- with open(os.path.join(mypath, f), 'rb') as f:
- reader = csv.reader(f, delimiter='|')
- print f
- print repr(reader)
- lines = list(reader)
- rec = lines[0]
- recs.append(rec)
-
- out_fn = './datasets/scholar_entries.csv'
- write_csv(out_fn, keys=None, chunk=recs)
-
-# Write a CSV
-def write_csv(fn, keys, chunk):
- print(fn)
- with open(fn, 'w') as f:
- writer = csv.writer(f)
- if keys is not None:
- writer.writerow(keys)
- for row in chunk:
- writer.writerow(row)
-
-if __name__ == '__main__':
- check_counts()