Creating New Columns, Sorting, and apply()
In this lesson, we will learn how to create new columns in Pandas, perform calculations based on existing columns, sort data, and apply custom functions to a DataFrame using apply(). ## Lesson objective In this lesson, we will learn how to create new columns, sort data, and use in Pandas. In the previous lessons, we learned how to create DataFrames, read data from files, filter data, clean data, and create summary results with . However, in real data analytics, existing columns are often not enough. We often need to create new calculated columns based on existing columns. For example, a data analyst may face questions such as: how is profit calculated from sales and cost?