Last answered:

12 Jan 2024

Posted on:

05 Jan 2024

0

Resolved: manipulating text data: loan status and Term

sir when i run the code i got array([36,60,60]) but it should be array([36,60]) ..tell me where i did mistake

1 answers ( 1 marked as helpful)
Posted on:

12 Jan 2024

0

Hello Dev Vansh,


I hope this message finds you well. I wanted to share a suggestion that might be helpful for achieving the desired output. If you modify the string to be removed to " months," you should be able to get the required result. It seems that the dataset contains a space before "months" (e.g., "36 months").


You can use the following code to achieve this:

loan_data_strings[:, 2] = np.chararray.strip(loan_data_strings[:, 2], " months")


I hope this suggestion proves useful for your task.


Kind regards.

Sailesh Krishnan.

Submit an answer