I need to read multiple csv files from S3 bucket with boto3 in python and finally combine those files in single dataframe in pandas.
I am able to read single file from following script in python
s3 = boto3.resource('s3')
bucket = s3.Bucket('test-bucket')
for obj in bucket.objects.all():
key = obj.key
body = obj.get()['Body'].read()
Following is my path
files/splittedfiles/Code-345678
In Code-345678
I have multiple csv
files which I have to read and combine it to single dataframe in pandas
Also, how do I pass a list of selected Codes
as a list,so that it will read those folders only. e.g.
files/splittedfiles/Code-345678
files/splittedfiles/Code-345679
files/splittedfiles/Code-345680
files/splittedfiles/Code-345681
files/splittedfiles/Code-345682
From above I need to read files under following codes only.
345678,345679,345682
How can I do it in python?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…