Creating columns
Sometimes we have to create new columns based on the data we have in order to better represent the information we currently have. For example, maybe we care more about the dollar value of our ticket sales than just the actual quantity of tickets we've sold.
Bu egzersiz
Python for Spreadsheet Users
kursunun bir parçasıdırEgzersiz talimatları
- Create a new column in
salescalledsales_usd, equal toticket_quantitymultiplied by 20. - Print the head of
sales.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Import the pandas package as pd
import pandas as pd
# Read in the Excel file
sales = pd.read_excel('ticket_sales.xlsx')
# Create a sales_usd column
sales[____] = sales[____] * ____
# Print the head of sales