In this challenge, you are given a table of closing stock prices for 10 different stocks with data going back as far as 1999. For each stock, calculate the interquartile range (IQR). Return a DataFrame that satisfies the following conditions:
Start this challenge in a Jupyter Notebook right now thanks to Binder (mybinder.org)
import pandas as pd
stocks = pd.read_csv('../data/stocks10.csv', index_col='date', parse_dates=['date'])
stocks.head()
There is a straightforward solution that completes this challenge in a single line of readable code. Can you find it?
If you are looking to completely master the pandas library and become a trusted expert for doing data science work, check out my book Master Data Analysis with Python. It comes with over 300 exercises with detailed solutions covering the pandas library in-depth.
Upon registration, you'll get access to the following free courses: