Want to create a new folder, getting an error.
Method:
def IDW_to_df(conn, quarter, file_name,sql_statement, *columns):
cursor = conn.cursor()
cursor.execute(sql_statement)
Dict = {}
for column in columns:
Dict[column]=[]
while 1:
row = cursor.fetchone()
if not row:
break
x = 0
for column in columns:
Dict[column].append(row[x])
x += 1
df = pd.DataFrame(Dict)
df.to_csv('H:/Q{0}/{1}.csv'.format(quarter,file_name))
return df
The method itself functions properly, just the folder creation throws the error. When called, I get the following error.
IOError: [Errno 2] No such file or directory: 'H:/Q4/FOO_IND.csv'