Created
July 29, 2020 12:07
-
-
Save timothymugayi/e098d947c0269981055c70bee1c58761 to your computer and use it in GitHub Desktop.
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 os | |
import math | |
import dask.dataframe as dd | |
import numpy as np | |
import pandas as pd | |
from dask.distributed import Client | |
client = Client('tcp://scheduler:8786') | |
# Lets toggle localstack by changing where boto3 is pointing to | |
if os.environ.get('LOCALSTACK_S3_ENDPOINT_URL'): | |
taxi_data = dd.read_csv( 's3://nyc-tlc/trip data/yellow_tripdata_2018-04.csv', | |
storage_options={ | |
'anon': True, | |
'use_ssl': False, | |
'key': 'foo', | |
'secret': 'bar', | |
"client_kwargs": { | |
"endpoint_url": os.environ.get('LOCALSTACK_S3_ENDPOINT_URL'), | |
"region_name": "us-east-1" | |
} | |
} | |
) | |
else: | |
# This assumes your using named profiles in aws cli with a default profile accessing your s3 bucket or EC2 | |
# instance or ECS task role | |
taxi_data = dd.read_csv('s3://nyc-tlc/trip data/yellow_tripdata_2018-04.csv') | |
taxi_data.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment