CommencerCommencer gratuitement

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

Cet exercice fait partie du cours

Financial Forecasting in Python

Afficher le cours

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.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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)
Modifier et exécuter le code