Insert Columns into a Pandas DataFrame
Let's find out how to add a column to a pandas DataFrame.
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Python 3.8
import pandas as pddf = pd.DataFrame([['Sterling', 83.4],['Cheryl', 97.2],['Lana', 13.2],], columns=['name', 'sum'])df.late_fee = 3.5print(df)
...