Visualizing a stock

Let's use the StockVisualizer to look at Netflix stock:

>>> %matplotlib inline>>> import matplotlib.pyplot as plt>>> netflix_viz = stock_analysis.StockVisualizer(nflx)

Once we initialize the StockVisualizer with the Netflix dataframe, we can generate many different plot types. We won't go over examples of everything this object lets us do; I will leave that up to you to experiment with. Let's take a look at the closing price over time and indicate where the maximum value occurred by adding a reference line:

>>> ax = netflix_viz.evolution_over_time(...     'close', figsize=(10, 4), legend=False, ...     title='Netflix closing price over time'... )>>> netflix_viz.add_reference_line(... ax, x=nflx.high.idxmax(), color='k', linestyle=':', ...

Get Hands-On Data Analysis with Pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.