I want to store a python pandas DataFrame to Azure, but the solution by Jay Gong (Python 2.7) gives me errors:
from azure.storage.blob import BlockBlobService
service = BlockBlobService(
account_name=STORAGE_ACCOUNT_NAME,
account_key=STORAGE_ACCOUNT_KEY
)
with io.StringIO() as stream:
df.to_csv(stream, encoding="utf-8")
service.create_blob_from_text('containert', 'example.txt', stream)
Returns:
AttributeError: '_io.StringIO' object has no attribute 'encode'
- python 3.7
- pandas 0.23.4
- azure-blob-storage 1.3.1