Created
May 31, 2019 09:58
-
-
Save devender-yadav/a1ba74b6e3f141a431a3373974185823 to your computer and use it in GitHub Desktop.
Running AWS Athena SQL queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
!{sys.executable} -m pip install PyAthena | |
from pyathena import connect | |
import pandas as pd | |
conn = connect(s3_staging_dir='s3://dev-sample-data123/temp', | |
region_name='ap-south-1') | |
df = pd.read_sql("SELECT * FROM rank_table limit 10;", conn) | |
# skipping header line | |
df1 = df.iloc[1:] | |
# changing datatype of rank to int | |
df1['rank'] = df1['rank'].astype(int) | |
df1.plot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment