Skip to content

Instantly share code, notes, and snippets.

@ronsims2
Last active August 21, 2020 14:23
Show Gist options
  • Save ronsims2/04a95ee60cb695796a4e61efb43a0e40 to your computer and use it in GitHub Desktop.
Save ronsims2/04a95ee60cb695796a4e61efb43a0e40 to your computer and use it in GitHub Desktop.
# image to base 64
from PIL import Image
import numpy as np
image = Image.open('~/some.image.png')
image_array = np.array(image)
image_data = base64.binascii.b2a_base64(image_array).decode('ascii')
# MySQL X DevAPI Python statements for retail_test shcema
# Sum records by date
dec = db.get_collection('sales_2018_12')
dec.find("`date` >= '2018-12-01' and `date` <= '2018-12-02'").fields('sum(amount_1) as total')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment