© Hannah Stepanek 2020
H. StepanekThinking in Pandashttps://doi.org/10.1007/978-1-4842-5839-2_2

2. Basic Data Access and Merging

Hannah Stepanek1 
(1)
Portland, OR, USA
 

There are many ways of accessing and merging DataFrames with pandas. This chapter will go over the basic methods for getting data out of a DataFrame, creating a sub-DataFrame, and merging DataFrames together.

DataFrame creation and access

pandas has a dictionary-like syntax that is very intuitive for those familiar with Python but not with pandas. Each column name is treated as a key, and the row values are returned as the value. The DataFrame object constructor also accepts a dictionary as a way of creating a DataFrame. Note when you get the column from a DataFrame, it points back to ...

Get Thinking in Pandas: How to Use the Python Data Analysis Library the Right Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.