Get startedGet started for free

Tesla income statement

The dataset for the Tesla income statement is called income_statement.

This dataset has a final column called Trailing Twelve Months (TTM), which is the most recent 12 months of data available. We will use this to calculate a 2018 forecast for Tesla.

We are only interested in the rows 'Revenue', 'Gross profit', 'Total operating expenses', and 'Net income', so we'll create a filtered income statement to only show these rows. The filtering code uses the following pattern.

dataframe[dataframe.columnname.isin(list_of_categories)]

This exercise is part of the course

Financial Forecasting in Python

View Course

Exercise instructions

  • Look at income_statement in the shell.
  • Create a list called interesting_metrics that contains the rows we are interested in as a list.
  • Use the .isin() method to filter the income statement for rows where metric is in interesting_metrics.
  • Look at the result.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Choose some interesting metrics
interesting_metrics = ['____', '____', '____', '____']

# Filter for rows containing these metrics
filtered_income_statement = income_statement[income_statement.____.____(____)]

# See the result
print(filtered_income_statement)
Edit and Run Code