# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 10:29:02 2017

@author: Michael Silva
"""
import pandas as pd
import sqlite3 as db

con = db.connect("2014 NY LEHD.sqlite")

print('Reading Crosswalk')
df = pd.read_csv('ny_xwalk.csv', low_memory=False)
print('Creating xwalk table')
df.to_sql('xwalk', con, if_exists='replace', index=False)
con.commit()

print('Reading LODES Main')
df = pd.read_csv('ny_od_main_JT00_2014.csv', low_memory=False)
print('Creating lodes table')
df.to_sql('lodes', con, if_exists='replace', index=False)
con.commit()

print('Reading LODES Aux')
df = pd.read_csv('ny_od_aux_JT00_2014.csv', low_memory=False)
print('Appending to lodes table')
df.to_sql('lodes', con, if_exists='append', index=False)
con.commit()

print('Adding in indexes')
c = con.cursor()
c.execute("CREATE INDEX `h_geocode` ON `lodes` (`h_geocode` )")
c.execute("CREATE INDEX `w_geocode` ON `lodes` (`w_geocode` )")

con.close()
print('Done')
de3c0c2209b0c036085e08919ab735ec810daafa
<mask token>

<mask token>
print('Reading Crosswalk')
<mask token>
print('Creating xwalk table')
df.to_sql('xwalk', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Main')
<mask token>
print('Creating lodes table')
df.to_sql('lodes', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Aux')
<mask token>
print('Appending to lodes table')
df.to_sql('lodes', con, if_exists='append', index=False)
con.commit()
print('Adding in indexes')
<mask token>
c.execute('CREATE INDEX `h_geocode` ON `lodes` (`h_geocode` )')
c.execute('CREATE INDEX `w_geocode` ON `lodes` (`w_geocode` )')
con.close()
print('Done')

<mask token>
con = db.connect('2014 NY LEHD.sqlite')
print('Reading Crosswalk')
df = pd.read_csv('ny_xwalk.csv', low_memory=False)
print('Creating xwalk table')
df.to_sql('xwalk', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Main')
df = pd.read_csv('ny_od_main_JT00_2014.csv', low_memory=False)
print('Creating lodes table')
df.to_sql('lodes', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Aux')
df = pd.read_csv('ny_od_aux_JT00_2014.csv', low_memory=False)
print('Appending to lodes table')
df.to_sql('lodes', con, if_exists='append', index=False)
con.commit()
print('Adding in indexes')
c = con.cursor()
c.execute('CREATE INDEX `h_geocode` ON `lodes` (`h_geocode` )')
c.execute('CREATE INDEX `w_geocode` ON `lodes` (`w_geocode` )')
con.close()
print('Done')

<mask token>
import pandas as pd
import sqlite3 as db
con = db.connect('2014 NY LEHD.sqlite')
print('Reading Crosswalk')
df = pd.read_csv('ny_xwalk.csv', low_memory=False)
print('Creating xwalk table')
df.to_sql('xwalk', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Main')
df = pd.read_csv('ny_od_main_JT00_2014.csv', low_memory=False)
print('Creating lodes table')
df.to_sql('lodes', con, if_exists='replace', index=False)
con.commit()
print('Reading LODES Aux')
df = pd.read_csv('ny_od_aux_JT00_2014.csv', low_memory=False)
print('Appending to lodes table')
df.to_sql('lodes', con, if_exists='append', index=False)
con.commit()
print('Adding in indexes')
c = con.cursor()
c.execute('CREATE INDEX `h_geocode` ON `lodes` (`h_geocode` )')
c.execute('CREATE INDEX `w_geocode` ON `lodes` (`w_geocode` )')
con.close()
print('Done')

# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 10:29:02 2017

@author: Michael Silva
"""
import pandas as pd
import sqlite3 as db

con = db.connect("2014 NY LEHD.sqlite")

print('Reading Crosswalk')
df = pd.read_csv('ny_xwalk.csv', low_memory=False)
print('Creating xwalk table')
df.to_sql('xwalk', con, if_exists='replace', index=False)
con.commit()

print('Reading LODES Main')
df = pd.read_csv('ny_od_main_JT00_2014.csv', low_memory=False)
print('Creating lodes table')
df.to_sql('lodes', con, if_exists='replace', index=False)
con.commit()

print('Reading LODES Aux')
df = pd.read_csv('ny_od_aux_JT00_2014.csv', low_memory=False)
print('Appending to lodes table')
df.to_sql('lodes', con, if_exists='append', index=False)
con.commit()

print('Adding in indexes')
c = con.cursor()
c.execute("CREATE INDEX `h_geocode` ON `lodes` (`h_geocode` )")
c.execute("CREATE INDEX `w_geocode` ON `lodes` (`w_geocode` )")

con.close()
print('Done')