The latter is possible and highly recommended - "inserting" lines by lines is highly inefficient. Sketch may be
>>> import numpy as np >>> import pandas as pd >>> index = np.arange(0, 10) >>> df = pd.DataFrame(index=index, columns=['foo', 'bar']) >>> df Out[268]: foo bar 0 NaN NaN 1 NaN NaN 2 NaN NaN 3 NaN NaN 4 NaN NaN 5 NaN NaN 6 NaN NaN 7 NaN NaN 8 NaN NaN 9 NaN NaN
source share