1.2 Dataframes and the ‘dot’ notation
In Week 2 you learned that dataframes have methods, which are like functions, that can only be called in the context of a dataframe.
For example, because the TB deaths dataframe has a column named ‘Country’, the method can be called like this:
df.sort_values('Country')
Because there is variable name, followed by a dot, followed by the method, this is called dot notation. Methods are said to be a property of a dataframe. In addition to methods, dataframes have another property – attributes.

Attributes
A dataframe attribute is like a variable that can only be accessed in the context of a dataframe. One such attribute is which holds a dataframe’s column names.
So the expression evaluates to the value of the attribute inside the dataframe . The following code will get and display the names of the columns in the dataframe
df.columns
Index(['Country', 'Population (1000s)', 'TB deaths'],
dtype='object')
OpenLearn - Introduction and guidance
Except for third party materials and otherwise, this content is made available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Licence, full copyright detail can be found in the acknowledgements section. Please see full copyright statement for details.
