I have a 227x4 DataFrame with country names and numerical values to clean (wrangle ?).
Here\'s an abstraction of the DataFrame:
import pandas as pd
i
Assign only columns of interest:
cols = ['Measure1','Measure2']
mask = df[cols].applymap(lambda x: isinstance(x, (int, float)))
df[cols] = df[cols].where(mask)
print (df)
Country Name Measure1 Measure2
0 uFv 7 8
1 vCr 5 NaN
2 qPp 2 6
3 QIC 10 10
4 Suy NaN 8
5 eFS 6 4
A meta-question, Is it normal that it takes me more than 3 hours to formulate a question here (including research) ?
In my opinion yes, create good question is really hard.