In [1]:
import numpy

In [2]:
numpy.sqrt(9)


Out[2]:
3.0

In [3]:
log(10)


-------------------------------------------------------
NameError             Traceback (most recent call last)
<ipython-input-3-7dbe859c6902> in <module>()
----> 1 log(10)

NameError: name 'log' is not defined

In [4]:
numpy.log(10)


Out[4]:
2.3025850929940459

In [5]:
import numpy as np

In [6]:
np.log(25)


Out[6]:
3.2188758248682006

To install a library use the following command in CMD: pip install numpy


In [7]:
import pandas_datareader as web

In [8]:
data  = web.DataReader('IBM','google')

In [9]:
data.head(10)


Out[9]:
Open High Low Close Volume
Date
2010-01-04 131.18 132.97 130.85 132.45 6155846
2010-01-05 131.68 131.85 130.10 130.85 6842471
2010-01-06 130.68 131.49 129.81 130.00 5605290
2010-01-07 129.87 130.25 128.91 129.55 5840569
2010-01-08 129.07 130.92 129.05 130.85 4197105
2010-01-11 131.06 131.06 128.67 129.48 5731177
2010-01-12 129.03 131.33 129.00 130.51 8083354
2010-01-13 130.39 131.12 129.16 130.23 6458302
2010-01-14 130.55 132.71 129.91 132.31 7114544
2010-01-15 132.03 132.89 131.09 131.78 8502320

In [10]:
my_stocks = ['IBM','DIS','AMZN']

In [11]:
for i in range(3):
    print(my_stocks[i])


IBM
DIS
AMZN

In [13]:
for i in range(len(my_stocks)):
    data = web.DataReader(my_stocks[i],"google")
    print(data.head(5))


              Open    High     Low   Close   Volume
Date                                               
2010-01-04  131.18  132.97  130.85  132.45  6155846
2010-01-05  131.68  131.85  130.10  130.85  6842471
2010-01-06  130.68  131.49  129.81  130.00  5605290
2010-01-07  129.87  130.25  128.91  129.55  5840569
2010-01-08  129.07  130.92  129.05  130.85  4197105
             Open   High    Low  Close    Volume
Date                                            
2010-01-04  32.50  32.75  31.87  32.07  13700385
2010-01-05  32.07  32.16  31.70  31.99  10307697
2010-01-06  31.90  32.00  31.68  31.82  10709499
2010-01-07  31.77  31.86  31.54  31.83   8202059
2010-01-08  31.66  31.94  31.53  31.88   7657457
              Open    High     Low   Close    Volume
Date                                                
2010-01-04  136.25  136.61  133.14  133.90   7600543
2010-01-05  133.43  135.48  131.81  134.69   8856456
2010-01-06  134.60  134.73  131.65  132.25   7180977
2010-01-07  132.01  132.32  128.80  130.00  11030124
2010-01-08  130.56  133.68  129.03  133.52   9833829

In [14]:
data.head()


Out[14]:
Open High Low Close Volume
Date
2010-01-04 136.25 136.61 133.14 133.90 7600543
2010-01-05 133.43 135.48 131.81 134.69 8856456
2010-01-06 134.60 134.73 131.65 132.25 7180977
2010-01-07 132.01 132.32 128.80 130.00 11030124
2010-01-08 130.56 133.68 129.03 133.52 9833829

In [15]:
data["Open"]


Out[15]:
Date
2010-01-04     136.25
2010-01-05     133.43
2010-01-06     134.60
2010-01-07     132.01
2010-01-08     130.56
2010-01-11     132.62
2010-01-12     128.99
2010-01-13     127.90
2010-01-14     129.14
2010-01-15     129.18
2010-01-19     126.20
2010-01-20     127.13
2010-01-21     127.26
2010-01-22     125.60
2010-01-25     122.10
2010-01-26     120.56
2010-01-27     121.03
2010-01-28     124.43
2010-01-29     129.77
2010-02-01     123.18
2010-02-02     118.79
2010-02-03     117.12
2010-02-04     118.64
2010-02-05     115.88
2010-02-08     119.38
2010-02-09     118.20
2010-02-10     118.00
2010-02-11     117.21
2010-02-12     118.99
2010-02-16     120.06
               ...   
2017-06-13     977.99
2017-06-14     988.59
2017-06-15     958.70
2017-06-16     996.00
2017-06-19    1017.00
2017-06-20     998.00
2017-06-21     998.70
2017-06-22    1002.23
2017-06-23    1002.54
2017-06-26    1008.50
2017-06-27     990.69
2017-06-28     978.55
2017-06-29     979.00
2017-06-30     980.12
2017-07-03     972.79
2017-07-05     961.53
2017-07-06     964.66
2017-07-07     969.55
2017-07-10     985.00
2017-07-11     993.00
2017-07-12    1000.65
2017-07-13    1004.62
2017-07-14    1002.40
2017-07-17    1004.69
2017-07-18    1006.00
2017-07-19    1025.00
2017-07-20    1031.59
2017-07-21    1021.28
2017-07-24    1028.34
2017-07-25    1038.05
Name: Open, dtype: float64

In [16]:
data["Open"].head()


Out[16]:
Date
2010-01-04    136.25
2010-01-05    133.43
2010-01-06    134.60
2010-01-07    132.01
2010-01-08    130.56
Name: Open, dtype: float64

In [17]:
data["Open"].describe()


Out[17]:
count    1902.000000
mean      380.111767
std       236.142138
min       105.920000
25%       198.270000
50%       302.075000
75%       523.725000
max      1038.050000
Name: Open, dtype: float64

In [18]:
data.describe()


Out[18]:
Open High Low Close Volume
count 1902.000000 1902.000000 1902.000000 1902.000000 1.902000e+03
mean 380.111767 383.863328 376.013139 380.176751 4.526623e+06
std 236.142138 237.413377 234.454167 236.060642 3.016636e+06
min 105.920000 111.290000 105.800000 108.610000 9.864350e+05
25% 198.270000 201.097500 195.227500 198.370000 2.734006e+06
50% 302.075000 304.530000 297.370000 301.125000 3.762743e+06
75% 523.725000 529.457500 516.842500 523.655000 5.305514e+06
max 1038.050000 1043.330000 1032.480000 1039.870000 4.242107e+07

In [19]:
import matplotlib.pyplot as plt

In [21]:
plt.plot(data["Open"])
plt.plot(data['High'])
plt.show()



In [ ]: