1str.isnumeric()
2str = u"this2009";
3print str.isnumeric()
4> False
5str = u"23443434";
6print str.isnumeric()
7> True
1import pandas as pd
2
3>>> df
4 country
50 US
61 UK
72 Germany
83 China
9>>> countries_to_keep
10['UK', 'China']
11>>> df.country.isin(countries_to_keep)
120 False
131 True
142 False
153 True
16Name: country, dtype: bool
17>>> df[df.country.isin(countries_to_keep)]
18 country
191 UK
203 China
21>>> df[~df.country.isin(countries_to_keep)]
22 country
230 US
242 Germany
1a = "\u0030" #unicode for 0
2b = "\u00B2" #unicode for ²
3c = "10km2"
4d = "-1"
5e = "1.5"
6
7print(a.isnumeric()) #True
8print(b.isnumeric()) #True
9print(c.isnumeric()) #False
10print(d.isnumeric()) #False
11print(e.isnumeric()) #False