Attribute notation accesses an object's attributes or methods by placing a dot between the object expression and the member name. In Python, the pattern is object.attribute. section 4.1.1
Attributes are values attached to a particular object, often established when the object is created. Reading one uses the object name, a period, and the attribute name. section 4.1.1 section 4.2
Common data-science uses include:
- Inspecting a scikit-learn model's configuration, such as forest_model.max_features, forest_model.n_estimators, or forest_model.max_depth. section 4.1.1
- Accessing data stored by a custom class, such as customer_obj.train_data after creating a DataSet object. section 4.2
- Chaining member access in data-processing expressions, as in train_data.churn.map(...), to transform a column. section 4.2
Inspect a model and dataset
forest_model.max_depth customer_obj.train_data The first expression reads a random forest configuration value; the second reads training data stored on a DataSet instance. section 4.1.1 section 4.2
Listing 4.4 Reference the max_features attributes of our forest_model object
forest_model.max_features #1
Inspect the focused syntax for reading an attribute from a RandomForestClassifier object. section 4.1.1
Listing 4.10 Access the train_data variable that was defined when we created the instance of our DataSet class.
customer_obj.train_data #1
See attribute notation applied to training data stored inside a custom DataSet object. section 4.2









