Create the given data frame. Add a new column to this data frame which is the product of Price and Quantity
Answers
Answered by
1
Answer:
To add a column to a Pandas dataframe you can simply assign values: df['YourColumn'] = [1, 2, 3, 4] . Importantly, the data you add must be of the same length as the other columns. If you want to add multiple columns, you can use assign() method: df = df. assign(Newcol1=YourData1, Newcol2=YourData2) .07-Jul-202
Similar questions