Everything looks to be fine here but still i'm seeing a very different error. Can anyone suggest what is flaw in my code as i'm able to execute it if i omit the to_csv
import pandas as pd
import pyodbc
con= pyodbc.connect("connection")
fr1=pd.read_csv("C:\folder\file1.csv")
fr2=pd.read_csv("C:\folder\file2.csv")
fr=pd.concat([df1,df2])
fr3=pd.read_sql_query(" select name, addr as ID from newtable", con )
result= pd.merge(fr3, fr, left_on='ID', right_on='URL', how='right')
matchset=result[result.ID.isnull()].to_csv("C:\match.csv")
nomatch=result[result.ID.notnull()].to_csv("C:\nomatch.csv")
Error:
**OSError [Errno 22] Invalid argument:'C:\match.csv' **