1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Introduction to Python for Finance

Connected

अभ्यास

Arrays and NumPy

NumPy is a scientific computing package in Python that helps you to work with arrays. Let's use array operations to calculate price to earning ratios of the S&P 100 stocks.

The S&P 100 data is available as the lists: prices (stock prices per share) and earnings (earnings per share).

निर्देश

100 XP
  • Import the numpy as np.
  • Convert the prices and earnings lists to arrays, prices_array and earnings_array, respectively.
  • Calculate the price to earnings ratio as pe.