Fix Python – Using python Logging with AWS Lambda

As the AWS documentation suggests:
import logging
logger = logging.getLogger()
def my_logging_handler(event, context):‘got event{}’.format(event))
logger.error(‘something went wrong’)

Now I made:
import logging
logging.basicConfig(level = logging.INFO)“Hello World!”)

The first snip….

Fix Python – How can I make a blank subplot in matplotlib?

I am making a group of subplot (say, 3 x 2) in matplotlib, but I have fewer than 6 datasets. How can I make the remaining subplot blank?
The arrangement looks like this:
| 0,0| 0,1|
| 1,0| 1,1|
| 2,0| 2,1|

This may go on for several pages, but on the final page, there are, for example, 5 datasets to….

Fix Python – How to convert CSV file to multiline JSON?

Here’s my code, really simple stuff…
import csv
import json

csvfile = open(‘file.csv’, ‘r’)
jsonfile = open(‘file.json’, ‘w’)

fieldnames = (“FirstName”,”LastName”,”IDNumber”,”Message”)
reader = csv.DictReader( csvfile, fieldnames)
out = json.dumps( [ row for row in reader ] )

Declare some field names, the reader uses CSV t….

Fix Python – How do I use a Boolean in Python?

Does Python actually contain a Boolean value? I know that you can do:
checker = 1
if checker:

But I’m quite pedantic and enjoy seeing booleans in Java. For instance:
Boolean checker;
if (someDecision)
checker = true;
//some stuff

Is there such a thing as a Boolean in Python? I can’t seem to find anything ….

Fix Python – Best way to do enum in Sqlalchemy?

I’m reading about sqlalchemy and I saw following code:
employees_table = Table(’employees’, metadata,
Column(’employee_id’, Integer, primary_key=True),
Column(‘name’, String(50)),
Column(‘manager_data’, String(50)),
Column(‘engineer_info’, String(50)),
Column(‘type’, String(20), nullable=False)

employee_mapper = mapper(Emplo….