replace only integer values in columns and use pd.cut to rename values?

Viewed 894

I have pandas dataframe 'lc' and want to replace only integer values to string.

            indexsum
    82445    start
    82446    start
    82447    start
    82448       11
    82449       10
    82450       12
    82451       12
    82452        9
    82453       11
    82454        9
    82455       10
    82456       10
    82457        9
    82458        9
    82459        9

I have compe up with using pd.cut method and write code like this, but error message showed up. It seemed like I can not use this code if I have string and integer values in the same column. What function do I have to use? (instead of mapping method)

 lc['lcindex'] = pd.cut(lc.indexsum, bins=[0,4,8,12,16], labels=["growth","mature","revival","decline"])

 TypeError: unorderable types: str() > float()
2 Answers
Related