Python help****

from webdav3.client import Client
from datetime import datetime
import pandas as pd
import dateutil
from dateutil import parser
from dateutil.parser import *
from sqlalchemy import create_engine
import os

#record db create date 
db_create_date=datetime.strptime(datetime.strftime(pd.to_datetime(datetime.utcnow()), '%Y-%m-%d %H:%M:%S'),'%Y-%m-%d %H:%M:%S') 
 
 
superstates_list = ['PRO_SUPERSTATE','PRO_SUPERSTATE_NEW']
 
for file in os.listdir(r'D:/Aspect_Files/Temp/'):
    if file.split('.')[0] in superstates_list:
        df=pd.read_csv(r'D:/Aspect_Files/Temp/'+file).fillna(0)
        del df['PRI_INDEX']
        del df['EMP_SK']
        del df['EMP_LAST_NAME']
        del df['EMP_FIRST_NAME']
        del df['EMP_SORT_NAME']
        del df['EMP_SHORT_NAME']
        del df['EMP_SENIORITY']
        del df['EMP_EFF_HIRE_DATE']
        del df['START']
        del df['STOP']
        del df['WRK_SEG']
        del df['GEN_SEG']
        del df['EMP_CLASS_1']
        del df['EMP_CLASS_1_DESCR']
        del df['EMP_CLASS_2']
        del df['EMP_CLASS_2_DESCR']
        del df['EMP_CLASS_3']
        del df['EMP_CLASS_3_DESCR']
        del df['EMP_CLASS_4']
        del df['EMP_CLASS_4_DESCR']
 
 
# Credentials to database connection
print(df)
 
df['NOM_DATE'] = [datetime.strptime(x,'%m/%d/%Y') for x in df['NOM_DATE']]
 
hostname='localhost'
dbname='aspect'
uname=''
pwd=""
 
# Create SQLAlchemy engine to connect to MySQL Database
db = create_engine("mysql+pymysql://{user}:{pw}@{host}/{db}"
                       .format(host=hostname, db=dbname, user=uname, pw=pwd))
 
#connect with database
conn = db.connect()
 
# Convert dataframe to sql table                                   
df.to_sql('superstate_staging', db, if_exists='append', index=False)
 
 
# close connection
 
conn.close()
 
# dispose engine
db.dispose()
 
 
exit()

Hi @Cmafer0901 ,

I’m sorry, but we don’t provide general Python support.

You’ll need to look for a beginner Python forum (and you’ll need to tell them what your problem is - a post of just your code isn’t going to get a very good response.)

Cheers!
–zak