1

variable - 'Item_Fat_Content' values - 'Low Fat', 'Regular', 'High fat', 'No fat'

These values on converting into label will take values of 0,1,2,3. On standardising, they will take up numerical values something like 0.0,0.4,0.5,0.9.

Will python consider this 'Item_Fat_Content' as categorical or numerical variable while applying algorithms?

  • 1
    It will consider as numerical variable. But I think you shouldn't use 0,1,2,3 but create four columns where you use binary values (f.e (Low Fat, Regular, High Fat, No fat) (0,0,0,1),(1,0,0,0) etc...) Because alghoritm might determine that "No Fat" has higher weight on result than "Low fat". – Poselsky Nov 28 '19 at 08:02
  • And the question is should you standardize binary variables? Here's a thread: https://stats.stackexchange.com/questions/59392/should-you-ever-standardise-binary-variables – Poselsky Nov 28 '19 at 08:04
  • try using One Hot Encoding as @OlegMusijenko said. You can use get_dummies in pandas [here](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.get_dummies.html) – Perl Del Rey Nov 15 '20 at 08:38

0 Answers0