introd u cing the dataset
play

Introd u cing the dataset IN TR OD U C TION TO P YTH ON FOR FIN - PowerPoint PPT Presentation

Introd u cing the dataset IN TR OD U C TION TO P YTH ON FOR FIN AN C E Adina Ho w e Instr u ctor O v erall Re v ie w P y thon shell and scripts Variables and data t y pes Lists Arra y s Methods and f u nctions Inde x ing and s u bse ing


  1. Introd u cing the dataset IN TR OD U C TION TO P YTH ON FOR FIN AN C E Adina Ho w e Instr u ctor

  2. O v erall Re v ie w P y thon shell and scripts Variables and data t y pes Lists Arra y s Methods and f u nctions Inde x ing and s u bse � ing Matplotlib INTRODUCTION TO PYTHON FOR FINANCE

  3. S & P 100 Companies Standard and Poor ' s S & P 100: made u p of major companies that span m u ltiple ind u str y gro u ps u sed to meas u re stock performance of large companies INTRODUCTION TO PYTHON FOR FINANCE

  4. S & P 100 Case St u d y Sectors of Companies w ithin the S & P 100 in 2017 INTRODUCTION TO PYTHON FOR FINANCE

  5. The data INTRODUCTION TO PYTHON FOR FINANCE

  6. Price to Earnings Ratio Market price Price to earning ratio = Earnings per share The ratio for v al u ing a compan y that meas u res its c u rrent share price relati v e to its per - share earnings In general , higher P / E ratio indicates higher gro w th e x pectations INTRODUCTION TO PYTHON FOR FINANCE

  7. Yo u r mission GIVEN Lists of data describing the S & P 100: names , prices , earnings , sectors OBJECTIVE PART I E x plore and anal yz e the S & P 100 data , speci � call y the P / E ratios of S & P 100 companies INTRODUCTION TO PYTHON FOR FINANCE

  8. Step 1: e x amine 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

  9. Step 2: Con v ert lists to arra y s # Convert lists to arrays import numpy as np my_array = np.array(my_list) INTRODUCTION TO PYTHON FOR FINANCE

  10. Step 3: Element w ise arra y operations # Elementwise array operations array_ratio = array1 / array2 INTRODUCTION TO PYTHON FOR FINANCE

  11. Let ' s anal yz e ! IN TR OD U C TION TO P YTH ON FOR FIN AN C E

  12. A closer look at the sectors IN TR OD U C TION TO P YTH ON FOR FIN AN C E Adina Ho w e Instr u ctor

  13. Yo u r mission GIVEN N u mp y arra y s of data describing the S & P 100: names , prices , earnings , sectors OBJECTIVE PART II E x plore and anal yz e sector - speci � c P / E ratios w ithin companies of the S & P 100 INTRODUCTION TO PYTHON FOR FINANCE

  14. Step 1: Create a boolean filtering arra y stock_prices = np.array([100, 200, 300]) filter_array = (stock_prices >= 150) print(filter_array) [ False True True] INTRODUCTION TO PYTHON FOR FINANCE

  15. Step 2: Appl y filtering arra y to s u bset another arra y stock_prices = np.array([100, 200, 300]) filter_array = (stock_prices >= 150) print(stock_prices[filter_array]) [200 300] INTRODUCTION TO PYTHON FOR FINANCE

  16. Step 3: S u mmari z e P / E ratios Calc u late the a v erage and standard de v iation of these sector - speci � c P / E ratios import numpy as np average_value = np.mean(my_array) std_value = np.std(my_array) INTRODUCTION TO PYTHON FOR FINANCE

  17. Let ' s practice ! IN TR OD U C TION TO P YTH ON FOR FIN AN C E

  18. Vis u ali z ing trends IN TR OD U C TION TO P YTH ON FOR FIN AN C E Adina Ho w e Instr u ctor

  19. Yo u r mission - o u tlier ? INTRODUCTION TO PYTHON FOR FINANCE

  20. Step 1: Make a histogram import matplotlib.pyplot as plt plt.hist(hist_data, bins = 8) plt.show() INTRODUCTION TO PYTHON FOR FINANCE

  21. Step 2: Identif y the O u tlier Identif y the o u tlier P / E ratio Create a boolean arra y � lter to s u bset this compan y Filter o u t this compan y information from the pro v ided datasets INTRODUCTION TO PYTHON FOR FINANCE

  22. Let ' s practice ! IN TR OD U C TION TO P YTH ON FOR FIN AN C E

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend