Brussels Mat. Step 3.a Residential Floor Space

In [1]:
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
In [2]:
bua = pd.read_excel("./IBSA/11.1_amenagement_territoire_occupation_sol_20151125.xls",
                    sheetname='11.1.1.4', skiprows = 1, #header = [0,1],
                    index_col = 0, skip_footer = 10)
In [3]:
def get_new_cols(iterable, keyword):
    if not isinstance(keyword, str):
        keyword = 'NaN'
    new_cols_0 = list()
    old_cols = str()
    for i in iterable:
        if isinstance(i, str) or isinstance(i, int):
            pass
        else:
            i = 'NaN'
        if keyword == i or (isinstance(i, str) and keyword in i):
            new_cols_0.append(str(old_cols))
        else:
            new_cols_0.append(str(i))
            old_cols = str(i)
    return(new_cols_0)
In [4]:
new_cols_0 = get_new_cols(bua.columns, 'Unnamed')
new_cols_1 = get_new_cols(bua.iloc[0,:], np.nan)
new_cols_2 = get_new_cols(bua.iloc[1,:], np.nan)
In [5]:
bua.columns = [new_cols_0, new_cols_1, new_cols_2]
bua = bua.iloc[2:, 1:]
bua = bua.T.sort_index()
In [6]:
#bua#.columns#.sort_values()
In [7]:
bau_build = bua.loc[(
    slice(None),
    slice(None),
    ['Bâti']), :]
In [8]:
bau_build.index = bau_build.index.droplevel([1,2])
bau_build = bau_build.T
bau_build.index = [i.replace('St', 'Saint') for i in bau_build.index]
bau_build = bau_build * 10000
In [9]:
hh = pd.read_excel("./IBSA/1.4_population_menages_20170829.xlsx",
                    sheetname='1.4.2.1', skiprows = 1, #header = [0,1],
                    index_col = 0, skip_footer = 10)
hh.loc[:, '1 personne'] = hh.iloc[:, 2]
hh = hh.iloc[1:, 2:-1]
hh.columns = ['hh_{}'.format(i) for i in range(1,9)]
hh = hh.mul([i for i in range(1,9)])
In [10]:
sqm = pd.read_excel('IBSA/log08_0_2001.xls',
                    header = 2,
                    index_col = 1,
                    skip_footer = 6
                   )
In [11]:
sqm = sqm.iloc[2:, [1]]
sqm.columns = ['sqm']
sqm = sqm.mul(hh.sum(axis=1), axis=0)
In [12]:
sqm.loc[:, 'bau'] = bau_build.loc[:, '2005']
In [13]:
sqm
Out[13]:
sqm bau
Territoire
Anderlecht 7.97353e+06 7.56164e+06
Auderghem 2.69623e+06 2.73296e+06
Berchem-Sainte-Agathe 1.879e+06 1.53595e+06
Bruxelles 1.22655e+07 1.38573e+07
Etterbeek 3.40235e+06 2.1059e+06
Evere 2.88231e+06 2.22417e+06
Forest 4.11621e+06 3.26044e+06
Ganshoren 1.79878e+06 1.10303e+06
Ixelles 6.27498e+06 3.91626e+06
Jette 3.73996e+06 2.60211e+06
Koekelberg 1.54673e+06 655600
Molenbeek-Saint-Jean 6.65206e+06 3.07914e+06
Saint-Gilles 3.29663e+06 1.6263e+06
Saint-Josse-ten-Noode 1.71305e+06 703388
Schaerbeek 9.55993e+06 4.41833e+06
Uccle 7.04683e+06 1.01344e+07
Watermael-Boitsfort 1.99856e+06 2.60981e+06
Woluwe-Saint-Lambert 4.41e+06 3.86748e+06
Woluwe-Saint-Pierre 3.73977e+06 4.76298e+06
In [17]:
sqm.sqm.sum()
Out[17]:
86992460.27692918
In [14]:
sqm.sqm.div(sqm.bau)
Out[14]:
Territoire
Anderlecht                1.05447
Auderghem                0.986561
Berchem-Sainte-Agathe     1.22335
Bruxelles                0.885134
Etterbeek                 1.61563
Evere                     1.29591
Forest                    1.26247
Ganshoren                 1.63076
Ixelles                   1.60229
Jette                     1.43728
Koekelberg                2.35926
Molenbeek-Saint-Jean      2.16036
Saint-Gilles              2.02707
Saint-Josse-ten-Noode     2.43542
Schaerbeek                 2.1637
Uccle                    0.695339
Watermael-Boitsfort      0.765788
Woluwe-Saint-Lambert      1.14028
Woluwe-Saint-Pierre      0.785174
dtype: object