Can you save a graph to s3 without saving the file locally first?
from boto.s3.connection import S3Connection
from boto.s3.key import Key
k = Key(bucket)
k.key = "mykey"
plt.savefig(k.key) //??
Can you save a graph to s3 without saving the file locally first?
from boto.s3.connection import S3Connection
from boto.s3.key import Key
k = Key(bucket)
k.key = "mykey"
plt.savefig(k.key) //??
BUCKET_NAME = 'enter your bucket name'
KEY = 'enter full path where to store the image'
df = pd.read_csv('./gene_expression.csv')
df.hist(by='Cancer Present', figsize=[12, 8], bins=15)
img_data = io.BytesIO()
plt.savefig(img_data, format='png')
img_data.seek(0)
s3 = boto3.resource('s3')
bucket = s3.Bucket(BUCKET_NAME)
bucket.put_object(Body=img_data, ContentType='image/png', Key=KEY)