Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Pandas
  • Table Of Contents Toc
Learning Pandas

Learning Pandas

By : Michael Heydt
4.2 (10)
close
close
Learning Pandas

Learning Pandas

4.2 (10)
By: Michael Heydt

Overview of this book

If you are a Python programmer who wants to get started with performing data analysis using pandas and Python, this is the book for you. Some experience with statistical analysis would be helpful but is not mandatory.
Table of Contents (14 chapters)
close
close
13
Index

Looking up values in Series


Values in a Series object can be retrieved using the [] operator and passing either a single index label or a list of index labels. The following code retrieves the value associated with the index label 'a' of the s3 series defined earlier:

In [28]:
   # single item lookup
   s3['a']

Out[28]:
   1

Accessing this Series using an integer value will perform a zero-based position lookup of the value:

In [29]:
   # lookup by position since the index is not an integer
   s3[1]

Out[29]:
   2

This is because pandas determines that the specified value is an integer and that the index is not an integer-based index. Given this, pandas decides to perform a lookup by position and not by index label.

To retrieve multiple items, you can pass a list of index labels via the [] operator. Instead of a single value, the result will be a new Series with both index labels and values, and data copied from the original Series.

In [30]:
   # multiple items
   s3[['a', 'c']]

Out[30]...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Pandas
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon