August 2019
Beginner
482 pages
12h 56m
English
Now, let's learn how to access and edit specific values in pandas data structures. We'll start with a toy example—here, I will generate a dataframe from a dictionary of lists:
import pandas as pddata = {'x':[1,2,3], 'y':['a', 'b', 'c'], 'z': [False, True, False]}df = pd.DataFrame(data)
Now, we can take a look at the data we just stored:
>>> df x y z 0 1 a False1 2 b True2 3 c False
As you can see, this frame has three rows and two columns. Let's see how it works:
>>> df['x'] 1 2 3Name: x, dtype: int ...