What is a good heuristic to detect if a column in a pandas.DataFrame is categorical?

后端 未结 7 676
旧时难觅i
旧时难觅i 2021-02-01 18:12

I\'ve been developing a tool that automatically preprocesses data in pandas.DataFrame format. During this preprocessing step, I want to treat continuous and categorical data dif

7条回答
  •  遥遥无期
    2021-02-01 18:58

    There's are many places where you could "steal" the definitions of formats that can be cast as "number". ##,#e-# would be one of such format, just to illustrate. Maybe you'll be able to find a library to do so. I try to cast everything to numbers first and what is left, well, there's no other way left but to keep them as categorical.

提交回复
热议问题