Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conn = pymysql.connect(host='localhost',
- user='test_user',
- password='',
- db='%s'%country_index)
- cur = conn.cursor()
- path = r'C:UsersRobinDesktopusa_indicator'
- filenames = glob.glob(path + '/*.csv')
- dfs = []
- for files in filenames:
- f = open(files)
- fString = f.read()
- fName = files[37:2]
- for lines in fString.split('n'):
- dfs.append(lines.split(','))
- DATE = dfs[0][1]; REALTIME_START = dfs[0][2]; VALUE = dfs[0][3]
- queryCreateTable = """CREATE TABLE '%s'(
- {} int,
- {} int,
- {} int
- )"""%fName.format(DATE, REALTIME_START, VALUE)
- cur.execute(queryCreateTable)
- conn.close()
Add Comment
Please, Sign In to add comment