Forecasting profit for Tesla
As in the previous exercise, the dataset for the Tesla income statement is named income_statement.
Using what we have learned in the previous exercise, we will now append a new column with 2018 Forecast data, which we will assign the header "Forecast".
For this exercise, we would like to set the filtered_income_statement to only show the row 'Revenue'.
Remember, the TTM column is the most recent 12-month value that we will use for the 2018 forecast. Thus far, we have the following information for 2018:
- The market demand analysis predicts the revenue to increase to 13,000 in 2018 due to increased sales of Model 3.
Deze oefening maakt deel uit van de cursus
Financial Forecasting in Python
Oefeninstructies
- Create a filtered income statement only for the
revenue_metricrow. - Get the number of columns of
filtered_income_statement, using the length (len()) of thecolumnsattribute. - Insert a new column in
filtered_income_statement.- Locate it at the end of the row (use
n_colsas thelocation). - Use
'Forecast'as the column name. - Insert the value
13000.
- Locate it at the end of the row (use
- Print the result.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
revenue_metric = ['Revenue']
# Filter for rows containing the revenue metric
filtered_income_statement = ____[____.____.____(____)]
# Get the number of columns in filtered_income_statement
n_cols = ____(filtered_income_statement.____)
# Insert a column in the correct position containing the column 'Forecast'
filtered_income_statement.insert(____, '____', ___)
# See the result
print(filtered_income_statement)