1
$\begingroup$

What are some of the systematic ways to categorise variables into categorical or numeric? I believe using only intuition in such scenarios can many-a-times lead to major irreversible errors. What are the best strategies when categorising variables?

For example, the dataframe I'm working has several categorical variables such as is_holiday that has labels for several holidays. However certain variables like visibility_in_miles suggest that those too need to be treated as categorical. part of the reason is that while most variables have hundreds of unique values, some have only 9 points.

$\endgroup$
3
$\begingroup$

The number of categories within a variable does not matter whether a variable is categorical or not.

Categorical variables are mutually exclusive, unordered groups. For example, Christmas and Halloween are different holidays but have no order in the concept of "holiday-ness".

Ordinal variables which are mutually exclusive, ordered groups with no consistent measure of the distance between the ordering. For example, ranking items (e.g., first, second, third, …). There could be big (or small) differences between each of the places.

Numeric variables have consistent differences between values. The difference between 10 and 11 miles is the same as the difference 20 and 21 miles because "mile-ness" is a consistent measure.

$\endgroup$
2
  • $\begingroup$ So would you suggest that dew_point for example, that has only values from 1 to 9 would be categorical since it suggests that there is no order and are mutually exclusive values? $\endgroup$ – Shiv_90 Aug 23 '19 at 13:52
  • $\begingroup$ I don't what is dew_point in your data set. If it is dew point temperature en.wikipedia.org/wiki/Dew_point, that is numeric because it is measured in degrees. Temperature degrees have consent differences (regardless of range). $\endgroup$ – Brian Spiering Aug 23 '19 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.