old_contents: 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_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()
  
  
new_contents: 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_dismembered_cur = conn.cursor()
  
  for key in range(1, len(dataframe)):
  	
   	sql = """drop table if exists {}_{} cascade""".format(hurricane_name, key) 
  
   	print sql 
  
   	drop_dismembered_cur.execute(sql)
   	conn.commit() 
  
  
  
  conn.close()
  
  
subject: Update drop_members.py