0

I am a newbie in python programming for data science. I was trying to convert numerical column values into bins with the code below:

bins = [12, 24, 48, 60, np.inf]
names = ['Tenure_12', 'Tenure_24', 'Tenure_48', 'Tenure_60']
telco['tenure_bin'] = pd.cut(telco['tenure'], bins, labels=names)

I am getting this error: TypeError: '<' not supported between instances of 'float' and 'str'. 'telco' is the name of the dataset and 'tenure' is the column name whose values I am trying to convert into bins

Can I please get some help on how to do away with this error?

Sarang123
  • 33
  • 1
  • 1
  • 10

1 Answers1

0

For your benifit, I recommend you give a working example. For instance, what's telco?
(This is not a comment only because my rep doesn't allow me)

ShlomiF
  • 2,686
  • 1
  • 14
  • 19