I am trying to use a function I found from this previous question Reading multiple csv files from S3 bucket with boto3 But I keep getting ValueError: DataFrame constructor not properly called!
This is the code below:
s3 = boto3.resource('s3',aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
bucket = s3.Bucket('test_bucket')
prefix_objs = bucket.objects.filter(Prefix=prefix)
prefix_df = []
for obj in prefix_objs:
key = obj.key
body = obj.get()['Body'].read()
df = pd.DataFrame(body)
When I print body all I get is a bunch of string starting with a b'