Python for Look with Condition

时间:2018-03-26 14:55:49

标签: python oracle

我希望为每个文件夹创建一个包含excel的文件夹,并希望根据行中的特定电子邮件地址隔离数据。如何使用for语句(conditional / where子句)

将SQL语句和/或创建excel创建到不同的文件夹中
orc_con = cx_Oracle.connect('xxx/xxx@xxxx.world')
SQL_Statement = 'select * from PYTHON_TEST' 
df_ora = pd.read_sql(SQL_Statement, con=orc_con)
for i in df_ora.itertuples():
    print(i)
writer = pd.ExcelWriter('XXXXX_Monthly_Claims.xlsx', engine='xlsxwriter')
df_ora.to_excel(writer, sheet_name='CCBHC',index=False)
# Get the xlsxwriter objects from the dataframe writer object.
workbook  = writer.book
worksheet = writer.sheets['Data']
# Close the Pandas Excel writer and output the Excel file.
writer.save()

0 个答案:

没有答案