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 it works...

The indexing operator changes behavior based on what type of object is passed to it. The following pseudocode outlines how DataFrame indexing operator handles the object that it is passed:

>>> df[item]  # Where `df` is a DataFrame and item is some objectIf item is a string then    Find a column name that matches the item exactly    Raise KeyError if there is no match    Return the column as a SeriesIf item is a list of strings then    Raise KeyError if one or more strings in item don't match columns    Return a DataFrame with just the columns in the list
If item is a slice object then   Works with either integer or string slices   Raise KeyError if label from label slice is not in index   Return all ROWS that are selected by the sliceIf item is ...
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