funded=r'C:\Users\hill\Desktop\wheels\Leads(1).csv'
funded= read_csv(funded)
funded=DataFrame(funded)
path='C:\Users\hvill\Destop\ '
funded.to_csv(path,'greenl.csv')
I want to have a variable that I can set the path in to_csv to. I tried path_or_buf = path. That doesn't work either.
You need to either escape your back slashes or better use a raw string:
path='C:\\Users\\hvill\\Destop\\'
or better as fewer characters:
path=r'C:\Users\hvill\Destop\'
I also think you want to do this when saving:
funded.to_csv(path+'greenl.csv')
To avoid the ambiguity and allow portability of your code you can use this:
import os
funded.to_csv(os.path.join(path,r'green1.csv'))
this will append your csv name to your destination path correctly
It may just be the case that you missed the k out of desktop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With