I want to append empty rows (filled with np.NaN) to a pandas dataframe and currently only know how to do this using loc
T = pd.DataFrame(index=['a', 'b', 'c'], data={'Col0': 0, 'Col1': 1})
T
Col0 Col1
a 0 1
b 0 1
c 0 1
missing = ['d', 'e']
for m in missing:
T.loc[m] = np.NaN
Col0 Col1
a 0.0 1.0
b 0.0 1.0
c 0.0 1.0
d NaN NaN
e NaN NaN
Do you know of a more elegant way to do this?
Why it is not possible to do something like
T.loc[missing] = np.NaN
thx!