Introducing the dataset

Introduction to Python for Finance

Adina Howe

Instructor

Overall Review

  • Python shell and scripts
  • Variables and data types
  • Lists
  • Arrays
  • Methods and functions
  • Indexing and subsetting
  • Matplotlib
Introduction to Python for Finance

S&P 100 Companies

Standard and Poor's S&P 100:

  • made up of major companies that span multiple industry groups
  • used to measure stock performance of large companies
Introduction to Python for Finance

S&P 100 Case Study

Sectors of Companies within the S&P 100 in 2017

piechart

Introduction to Python for Finance

The data

s&p

Introduction to Python for Finance

Price to Earnings Ratio

$$ \text{Price to earning ratio} = \frac{\text{Market price}}{\text{Earnings per share}} $$

  • The ratio for valuing a company that measures its current share price relative to its per-share earnings
  • In general, higher P/E ratio indicates higher growth expectations
Introduction to Python for Finance

Your mission

Given

Lists of data describing the S&P 100: names, prices, earnings, sectors

Objective Part I

Explore and analyze the S&P 100 data, specifically the P/E ratios of S&P 100 companies

Introduction to Python for Finance

Step 1: examine the lists

In [1]:  my_list = [1, 2, 3, 4, 5]

# first element
In [2]: print(my_list[0])
1
# last element
In [3]: print(my_list[-1])
5
# range of elements
In [4]: print(my_list[0:3])
[1, 2, 3]
Introduction to Python for Finance

Step 2: Convert lists to arrays

# Convert lists to arrays
import numpy as np
my_array = np.array(my_list)
Introduction to Python for Finance

Step 3: Elementwise array operations

# Elementwise array operations
array_ratio = array1 / array2
Introduction to Python for Finance

Let's analyze!

Introduction to Python for Finance

Preparing Video For Download...