import pandas as pd
candy = pd.read_csv('data/candybars.csv')
candy
25 rows × 6 columns
candy.columns
Index(['name', 'weight', 'chocolate', 'peanuts', 'caramel', 'available_canada_america'], dtype='object')
candy.shape
(25, 6)
candy.head(2)
candy.head()
Take candy.shape as an example.
In this case, our dataframe candy is our object and .shape is the attribute describing it.
.shape
In the example of pd.read_csv(), this function does the action of reading in our data.
pd.read_csv()
# This line does not execute anything.
candy.shape # This will output the shape of the dataframe
Comments