LoslegenKostenlos loslegen

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)]

Diese Übung ist Teil des Kurses

Financial Forecasting in Python

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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)
Code bearbeiten und ausführen