[英]how to upload .csv file to azure folder in python
Anyone know to to upload a .csv file to a folder inside a blob container in python?有人知道将 .csv 文件上传到 python 中 blob 容器内的文件夹吗? i'm having difficulty trying to acess the folders inside it.
我在尝试访问其中的文件夹时遇到困难。 i have the csv and want to save it inside the blob folder, but it didn't work.
我有 csv 并想将它保存在 blob 文件夹中,但它没有用。 the file is in code, so i dont want to pass the directory where it is.
该文件在代码中,所以我不想传递它所在的目录。
csv = df.to_csv()
block_blob_service.create_blob_from_path(container_name, 'folder/csv/mycsv/' , csv)
Someone knows how i can save the csv directly to the folder inside the storage folder (folder/csv/mycsv/) in azure?有人知道如何将 csv 直接保存到 azure 中的存储文件夹(文件夹/csv/mycsv/)内的文件夹中?
i got an error stat: path too long for Windows我收到一个错误统计信息:Windows 的路径太长
Reading the documentation of DataFrame.to_csv
, I believe csv
variable actually contains string
type data.阅读
DataFrame.to_csv
的文档,我相信csv
变量实际上包含string
类型数据。 If that's the case, then you will need to use create_blob_from_text
method.如果是这种情况,那么您将需要使用
create_blob_from_text
方法。
So your code would be:所以你的代码是:
csv = df.to_csv()
block_blob_service.create_blob_from_text(container_name, 'folder/csv/mycsv/' , csv)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.