import sys
import os
import datetime
import psycopg2
import pandas
from subprocess import call, Popen

conn_string = "dbname='hamlethurricane' user=postgres port='5432' host='127.0.0.1' password='password'"

print "Connecting to database..."

try:
	conn = psycopg2.connect(conn_string)
except Exception as e:
	print str(e)
	sys.exit()

print "Connected!\n"

hurricane_name = 'ARTHUR'

dataframe_cur = conn.cursor()

dataframe_sql = """Select * from hurricane_{}""".format(hurricane_name)

dataframe_cur.execute(dataframe_sql)

data = dataframe_cur.fetchall()

colnames = [desc[0] for desc in dataframe_cur.description]

dataframe = pandas.DataFrame(data)

dataframe.columns = colnames

conn.commit()

range_feat =  range(len(dataframe))

range_feat_strp = str(range_feat).strip('[]')

range_feat_strp_v2 = range_feat_strp.split(',')

print range_feat_strp_v2

drop_if_geo_sql = """drop table if exists hurricane_{}_geo""".format(hurricane_name)

drop_if_geo_cur = conn.cursor()

drop_if_geo_cur.execute(drop_if_geo_sql)

drop_dismembered_cur = conn.cursor() 

for key in range(1, len(dataframe)-1):
	
 	sql = """drop table if exists {}_{} cascade""".format(hurricane_name, key) 

 	print sql 

 	drop_dismembered_cur.execute(sql)
 	conn.commit() 



conn.close()

@@ -857,208 +857,8 @@
 v2%0A%0A
-drop_if_geo_sql = %22%22%22drop table if exists hurricane_%7B%7D_geo%22%22%22.format(hurricane_name)%0A%0Adrop_if_geo_cur = conn.cursor()%0A%0Adrop_if_geo_cur.execute(drop_if_geo_sql)%0A%0Adrop_dismembered_cur = conn.cursor() %0A%0A
 for 

Update drop_members.py