Last answered:

04 Sept 2023

Posted on:

08 Nov 2022

0

Another way of using np.where() !?

Hi everyone,

Since I want to substitute every number of 2000 with number 20 in Lending-Company-Numeric-Data-NAN, used in this video. I wonder the following code would work properly or not:



import_numeric_NAN_csv = np.genfromtxt('Lending-Company-Numeric-Data-NAN.csv', delimiter = ';')
import_numeric_NAN_csv = np.where(import_numeric_NAN_csv[:, :] == 2000, 20, import_numeric_NAN_csv[:, :])



After running the code above, I see only number 20 without any 2000 anymore, and the quantitative of nan values are still the same. But does it work properly? Any advice?
Thanks!




1 answers ( 0 marked as helpful)
Posted on:

04 Sept 2023

0

Hi, 

That's because you set you whole data equal to 2000 as condition so to avoid that you need to spcifiy column or row


Submit an answer