Skip to Content
Numerical Computing with Python
book

Numerical Computing with Python

by Pratap Dangeti, Allen Yu, Claire Chung, Aldrin Yim
December 2018
Beginner to intermediate
682 pages
18h 1m
English
Packt Publishing
Content preview from Numerical Computing with Python

How to do it...

  1. Read in the Schlumberger stock data, put the Date column into the index, and convert it to a DatetimeIndex:
>>> slb = pd.read_csv('data/slb_stock.csv', index_col='Date',                      parse_dates=['Date'])>>> slb.head()
  1. Select the closing price as a Series and use the describe method to return summary statistics as a Series:
>>> slb_close = slb['Close']>>> slb_summary = slb_close.describe(percentiles=[.1, .9])>>> slb_summarycount    1895.000000
mean       79.121905
std        11.767802
min        51.750000
10%        64.892000
50%        78.000000
90%        93.248000
max       117.950000
Name: Close, dtype: float64
  1. Using boolean selection, select all closing prices in the upper or ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781789953633OtherOtherErrata Page