W3docs

Creating an empty Pandas DataFrame, and then filling it

Note that in above example, the DataFrame is created empty first, and then columns are added one by one using the assignment operator (=).

Creating an empty Pandas DataFrame, and then filling it in Python

python— editable, runs on the server
Info

Watch a video course: Python - The Practical Guide

Note that in above example, the DataFrame is created empty first, and then columns are added one by one using the assignment operator (=). The column names are specified as strings inside square brackets ([]). The column data is added as a list.