Filtering stock data.
For this exercise you will be filtering Alphabet stock data, once again working with a DataFrame alphabet
. The head of the DataFrame looks like this:
close | volume | open | high | low | |
---|---|---|---|---|---|
date | |||||
2019-08-02 | 1196.32 | 1745450 | 1203.00 | 1209.500 | 1190.00 |
2019-08-01 | 1211.78 | 1771271 | 1217.63 | 1236.298 | 1207.00 |
2019-07-31 | 1218.20 | 1997999 | 1224.87 | 1234.910 | 1208.18 |
2019-07-30 | 1228.00 | 1430775 | 1227.00 | 1236.910 | 1225.32 |
2019-07-29 | 1241.84 | 2069127 | 1242.50 | 1248.995 | 1230.20 |
This exercise is part of the course
Intermediate Python for Finance
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Mask for large enough daily high
high_mask = alphabet.high ____ 500
# Filter using the mask
alphabet.____[____]