Slicing

The slice operation behaves the same way as a NumPy array. Slicing can be done using the index numbers as shown in the following code:

# Slice till the 4th index (0 to 3)
In [31]: stockPriceSeries[:4]
Out[31]:
GOOG 1200.00
FB 62.57
YHOO NaN
TWTR 64.50
Name: stockPrices, dtype: float64
Logical slicing also works as follows:
In [32]: stockPriceSeries[stockPriceSeries > 100]
Out[32]:
GOOG 1200.00
AMZN 358.69
AAPL 500.60
Name: stockPrices, dtype: float64
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset