【发布时间】:2020-12-12 04:33:15
【问题描述】:
我需要将我的 pandas 数据框作为 csv 导出到文件夹中。我的 python 解决方案部署在 IIS 服务器上,在那里我得到“file_path”和 url,我使用这两件事来获取或读取我的文件。 这是我为读取传入文件所做的。
from urllib.parse import quote
url = "http://20.9.6.11:8066" -- given
file_path = "file_upload/file_info/products/class1/file.csv" --given
incoming_file_path = url + "/" + quote(file_path)
df = pd.read_csv(incoming_file_path)
我可以使用上面的代码成功地获取或读取我的 csv 文件,但是在我的数据被处理之后 我需要将该 csv 导出到我无法导出的其他文件夹。我做到了:
folder_to_export_path = "http://20.9.6.11:8066/file_info/products/processed_file"
clean_df.to_csv(r'folder_to_export_path+'filename.csv') # error
【问题讨论】:
-
你遇到什么错误?
-
@ChandanKumar 我试过了,出现以下错误:OSError: [Errno 22] Invalid argument: '20.9.6.11:8066/file_info/products/processed_file/filename.csv'
标签: python python-3.x pandas dataframe iis