简体   繁体   English

如何将.csv文件上传到python中的azure文件夹

[英]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.

相关问题 使用python将CSV文件上载到Microsoft Azure存储帐户 - Upload CSV file into Microsoft Azure storage account using python 使用 python 创建 csv 文件并将其上传到 azure blob 存储 - Create and upload csv file to azure blob storage using python 如何使用 python 将 csv 文件上传到 API - How to upload csv file to API using python 如何在Python中的特定文件夹中创建一个csv文件? - How to create a csv file in a specific folder in Python? 如何使用 Python 递归地将文件夹上传到 Azure blob 存储 - How to recursively upload folder to Azure blob storage with Python 如何通过 Python 将数据帧作为 csv 上传到 azure? - How can I upload a dataframe as csv to azure by Python? 如何将a文件夹上传到Azure blob存储中,同时保留Python中的结构? - How to upload the a folder into Azure blob storage while preserving the structure in Python? 如何将文件夹中的多个 CSV 文件合并为 Azure 上的单个文件? - How to merge multiple CSV files in a folder to a single file on Azure? 将多个 csv 文件上传到 python 中的 sharepoint 文件夹? - upload multiple csv files to sharepoint folder in python? Python - 上传 csv 文件到 Dropbox - Python - upload csv file to Dropbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM