import pandas as pd import numpy as np
df = pd.DataFrame({'SKU': [700, 701, 702, 702, 703, 704, 705, 705], 'CATEGORY': ['T', 'F', 'F', nan, 'W', 'W', 'T', nan]
})
print (df)
I sorted the original data according to 'SKU', and tried using .ffill to fill the value with preceding value. But it still shows 'nan' when I check the using .value_counts() for 'CATEGORY'.
According to human understanding, the 'nan' values should be 'F' and 'T' respectively. How to I do these changes for all the missing values in the dataset?