isAttribute function

The isAttribute function checks whether a specified attribute is present in the dataset. The result can either be returned as a Boolean (true/false) or binary (0/1) result.

This function is useful for large datasets.


Parameters

isAttribute(name, binary)

Parameter

Description

name

The name of the attribute we are looking for. The name parameter is mandatory.

binary

If set to True, or simply not specified, results will be provided as a Boolean (True/False), while if set to False, results will be provided in binary form (1/0).


Example

The following example uses the adult dataset.

Description

Screenshot

In the adult dataset, we have added a new attribute, called Present_in_dataset, where the results of the isAttribute function will be saved. We will then check to see whether there is an attribute called education in the dataset, with the formula isAttribute("education").

As we have not specified a value for the binary parameter, the results will be expressed as a Boolean value: True in this specific case.

If we wanted to receive the result in binary form instead of a True/False Boolean value, we would need to specify that the binary parameter should be False, with the following formula: isAttribute("education", False).