Creating an empty Pandas DataFrame, then filling it?

Posted by Editorial Staff | Updated on

Creating an empty Pandas DataFrame, then filling it? Here’s a couple of suggestions: Use date_range for the index:

Note: we could create an empty DataFrame (with NaNs) simply by writing:

To do these type of calculations for the data, use a numpy array:

Hence we can create the DataFrame:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers