def calculate_cluster_centers(locations_with_clusters):
    """
    Calculate cluster centers
    :param locations_with_clusters:
    :return:
    """
    cluster_lat_lons = locations_with_clusters.groupby(['CLUSTER'],
        as_index=False).agg({'LATITUDE': 'sum', 'LONGITUDE': 'sum',
        'LOCATION_NAME': 'count'}).rename(columns={'LATITUDE':
        'NEW_CLUSTER_LATITUDE', 'LONGITUDE': 'NEW_CLUSTER_LONGITUDE',
        'LOCATION_NAME': 'NUMBER_OF_CUSTOMERS_IN_A_CLUSTER'})
    cluster_lat_lons['NEW_CLUSTER_LATITUDE'] = cluster_lat_lons[
        'NEW_CLUSTER_LATITUDE'] / cluster_lat_lons[
        'NUMBER_OF_CUSTOMERS_IN_A_CLUSTER']
    cluster_lat_lons['NEW_CLUSTER_LONGITUDE'] = cluster_lat_lons[
        'NEW_CLUSTER_LONGITUDE'] / cluster_lat_lons[
        'NUMBER_OF_CUSTOMERS_IN_A_CLUSTER']
    cluster_lat_lons['CLUSTER_LATITUDE'] = cluster_lat_lons[
        'NEW_CLUSTER_LATITUDE']
    cluster_lat_lons['CLUSTER_LONGITUDE'] = cluster_lat_lons[
        'NEW_CLUSTER_LONGITUDE']
    cluster_lat_lons.drop(['NEW_CLUSTER_LATITUDE', 'NEW_CLUSTER_LONGITUDE',
        'NUMBER_OF_CUSTOMERS_IN_A_CLUSTER'], 1, inplace=True)
    return cluster_lat_lons
