简体   繁体   English

如何使用 python 脚本将 Pandas 数据帧写入 AWS Athena 表

[英]How to write a pandas dataframe to AWS Athena table using python script

I am having dataframe like below我有如下所示的数据框

Rate.head(4)

 KG  Europe_Rate  NAP_Rate
 1     10          8
 2     16          12
 3     19          16
 4     22          18

I want insert this data into AWS table.我想将此数据插入 AWS 表中。 How can this be done?如何才能做到这一点?

Database: Rate
Table   :Customer_Rate

The columns types in AWS athena is double ( KG, Europe_Rate, NAP_Rate). AWS athena 中的列类型是双精度的(KG、Europe_Rate、NAP_Rate)。

AWS Athena queries data on S3. AWS Athena 在 S3 上查询数据。 It supports many different types of data such as CSV, JSON, Parquet, etc. If you write your data frame as a CSV to an S3 bucket and then create a table in Athena you will be able to query the data with Athena.它支持许多不同类型的数据,例如 CSV、JSON、Parquet 等。如果您将数据帧作为 CSV 写入 S3 存储桶,然后在 Athena 中创建表,您将能够使用 Athena 查询数据。 You can find an example of how to create a table that reads CSV data here: https://docs.aws.amazon.com/athena/latest/ug/lazy-simple-serde.html您可以在此处找到有关如何创建读取 CSV 数据的表的示例: https : //docs.aws.amazon.com/athena/latest/ug/lazy-simple-serde.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们如何将 dataframe 写入 AWS Athena 中的表? - How can we write a dataframe to a table in AWS Athena? How can I read data from AWS- Aurora postgresql as python pandas DataFrame and write the same to Oracle table? - How can I read data from AWS- Aurora postgresql as python pandas DataFrame and write the same to Oracle table? 如何将pandas数据帧作为表写入MySQL数据库? - How to write a pandas dataframe as a table into a MySQL database? 如何使用python在Dash中将html_Table转换为pandas数据帧? - How to convert html_Table to pandas dataframe in Dash using python? 如何通过 Python 脚本向 Athena exists 表中的特定 position 添加一列? - How can I add a column to specific position in Athena exists table by Python script? Python Pandas - 如何在不使用 dataframe 的情况下通过索引将字符串写入特定单元格 - Python Pandas - how to write a string to a spcific cell via index without using the dataframe 如何在python的S3中从pandas数据帧写入镶木地板文件 - How to write parquet file from pandas dataframe in S3 in python 如何在python lambda中对aws athena sql查询进行单元测试? - How to unit test aws athena sql queries in python lambda? 如何使用pandas数据框从磁盘读取和写入文件? - How to read and write files from disk using the pandas dataframe? 如何在不使用熊猫或任何包的情况下编写数据帧? - How to write a dataframe without using pandas or any package?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM