Solution for How to create an empty Pandas DataFrame and fill it in Python : You can use pandas.DataFrame to fill a DataFrame Call pandas.DataFrame(data, index=labels, columns=names) with data as a two-dimensional list and labels and names as lists to create a DataFrame filled with the elements in data. labels specifies index labels and names specifies column names.
Calling DataFrame(index=index_names, colummns=col_names) will create a DataFrame filled with NaN’s. However, doing this, and filling it iteratively with DataFrame.append() or DataFrame.loc will cause serious performance issues when creating large DataFrames. So it is best practice to obtain the data beforehand, and instantiate everything together.