0
$\begingroup$

I have a dataframe as below:

class 1 class 2
0 M NaN
1 17245 NaN
2 graduate Bach

I want to use pd.cut() function and bin the data 17245 to 15000-25000. How do I do it?

$\endgroup$
4
  • $\begingroup$ isn't 17425 already in between 15000-25000? Can you stare more clearly what exactly is the requirement? NB pd.cut doc can help you. $\endgroup$
    – Aditya
    Jun 21, 2021 at 1:57
  • $\begingroup$ I want to update the cell value from 17245 to 15000-25000 using pd.cut. Not sure how to select that one cell and make changes. $\endgroup$ Jun 21, 2021 at 2:11
  • $\begingroup$ This is probably what you need. Although your data is trange: why does class1 contain different types of data? how do you want to bin strings? $\endgroup$
    – Erwan
    Jun 21, 2021 at 22:43
  • $\begingroup$ I just want to bin that one cell, not the entire column. It has different types of data because that column defines the class. $\endgroup$ Jun 22, 2021 at 0:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.