From 45c931b3f90742f306aaf813ed8a9964d7e41d5f Mon Sep 17 00:00:00 2001 From: rasbt Date: Fri, 6 Feb 2015 12:01:46 -0500 Subject: [PATCH] updated readme --- useful_scripts/large_csv_to_sqlite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/useful_scripts/large_csv_to_sqlite.py b/useful_scripts/large_csv_to_sqlite.py index 633ea8c..5e67691 100644 --- a/useful_scripts/large_csv_to_sqlite.py +++ b/useful_scripts/large_csv_to_sqlite.py @@ -17,6 +17,9 @@ out_sqlite = '../data/my.sqlite' table_name = 'my_table' # name for the SQLite database table chunksize = 100000 # number of lines to process at each iteration +# columns that should be read from the CSV file +columns = ['molecule_id','charge','db','drugsnow','hba','hbd','loc','nrb','smiles'] + # Get number of lines in the CSV file nlines = subprocess.check_output('wc -l %s' % in_csv, shell=True) nlines = int(nlines.split()[0]) @@ -33,7 +36,7 @@ for i in range(0, nlines, chunksize): skiprows=i) # skip rows that were already read # columns to read - df.columns = ['molecule_id','charge','db','drugsnow','hba','hbd','loc','nrb','smiles'] + df.columns = columns sql.to_sql(df, name=table_name,