From f31cc17d3c51f7ce4bd2e0fd44eb898683e1e2ad Mon Sep 17 00:00:00 2001 From: anish03 Date: Wed, 3 Oct 2018 22:44:08 -0700 Subject: [PATCH] Updated csv2json utility --- csv2json/csv2json.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/csv2json/csv2json.py b/csv2json/csv2json.py index 78f426d..6677a73 100644 --- a/csv2json/csv2json.py +++ b/csv2json/csv2json.py @@ -3,8 +3,8 @@ import numpy as np import time -def main(): - df = pd.read_csv('yelp_business.csv') +def csv2json(csv_file): + df = pd.read_csv(csv_file) print len(df) h1 = h = list(df.columns.values) @@ -34,5 +34,9 @@ def main(): target.write(rec+'\n') target.close() +def main(): + csv_file = sys.argv[1] + csv2json(csv_file) + if __name__ == '__main__': main()