简体   繁体   中英

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. 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 queries data on 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM