大家下午好,
我正在尝试将多个数据帧保存到不同工作表上的excel工作簿。然后将该工作簿上传到亚马逊S3存储桶。下面的代码以99%的方式工作,但是writer.save()在我的S3存储桶中找不到我的excel文件。如果您知道解决此问题的方法,请提供帮助。谢谢。
#Exports the data back to Excel - PLEASE READ LINE BELOW THIS CODE
bucket='sagemaker-bucket-xxxx/xxxx/xxxxx'
data_key = 'Provider Data.xlsx'
data_location = 's3://{}/{}'.format(bucket, data_key)
writer = pd.ExcelWriter(data_location) #Targets the file where data is to be sent to
Comparison.to_excel(writer,'DATA') #Targets the worksheet data is to be sent too
df_current.to_excel(writer,'New Records') #Targets the worksheet data is to be sent too
df_prev.to_excel(writer,'Old Records') #Targets the worksheet data is to be sent too
df_same.to_excel(writer,'Same Records') #Targets the worksheet data is to be sent too
ALLCOUNT.to_excel(writer,'RPN Roll Up Count') #Targets the worksheet data is to be sent too
writer.save() #Saves files下面列出了错误消息。
FileNotFoundError: Errno 2没有这样的文件或目录:‘s3://sagemaker-bucket-xxxx/Provider Data.xlsx’
发布于 2019-05-11 21:43:51
s3不是一个标准的文件系统,你可以用框架(如Pandas)来读写,这些框架不知道数据位置的不同接口。
最简单的方法是在本地将其写入notebook实例的文件系统,然后运行aws s3 cp将其上传到s3。
https://stackoverflow.com/questions/56031922
复制相似问题