Pandas fundamentals
While NumPy deals mostly with arrays, Pandas main data structures are pandas.Series, pandas.DataFrame, and pandas.Panel. In the rest of this chapter, we will abbreviate pandas with pd.
The main difference between a pd.Series object and an np.array is that a pd.Series object associates a specific key to each element of an array. Let’s see how this works in practice with an example.
Let's assume that we are trying to test a new blood pressure drug, and we want to store, for each patient, whether the patient's blood pressure improved after administering the drug. We can encode this information by associating to each subject ID (represented by an integer), True if the drug was effective, and False otherwise.
We can create ...
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.
Read now
Unlock full access