@ajax_request
@login_required
@has_perm('can_modify_data')
def add_meter_to_building(request):
    body = json.loads(request.body)
    building_id = body.get('building_id', '')

    building = BuildingSnapshot.objects.get(pk=building_id)

    meter_name = body.get('meter_name', '')
    energy_type_name = body.get('energy_type', 'Electricity')
    energy_unit_name = body.get('energy_units', 'kWh')
    # Grab the integer representation of the energytype from ENERGY_TYPES.
    energy_type = convert_choice_data(energy_type_name, ENERGY_TYPES)
    energy_units = convert_choice_data(energy_unit_name, ENERGY_UNITS)

    meter = Meter.objects.create(
        name=meter_name, energy_type=energy_type, energy_units=energy_units
    )

    meter.building_snapshot.add(building)
    meter.save()

    return {'status': 'success'}
if we have an object dtype, try to coerce dates and/or numbers
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/views/meters.py/add_meter_to_building--crossover with--dataset/ETHPy150Open pydata/pandas/pandas/core/convert.py/_possibly_convert_objects