url category 0 0800-horoscope.com G 1 18games.net X 2 1pixelout.net G 3 1porno.com/004/teens/index.html X 4 1stpussy.com/005/16/index.html X
print labels.head()
turk url category 0 A1OT3A29R9N1DG 000.cc P 1 A1PXXEOGQ76RNJ 000.cc G 2 A1PXXEOGQ76RNJ 000.cc G 3 A21US576U8SCO4 000.cc G 4 A2LGX47NN7C5D3 000.cc G
gold
for i in gold['url']: labels[labels['url']==i]['category'] == str(gold[gold['url']==i]['category'])
245 False 246 False 247 False 248 False 249 False 250 False 251 False 252 False 253 False 254 False 255 False 256 False 257 False 258 False 259 False 260 False 261 False 262 False 263 False 264 False Name: category, dtype: bool
df1
url category 0 google.com G 1 yahoo.com S
df2
turk url category 0 1 google.com G 1 2 yahoo.com S 2 3 google.com S
True True False
url
m = df1.set_index('url')['category']
df2.url.map(m) == df2.category
0 True 1 True 2 False dtype: bool
NaN
False
map
InvalidIndexError: Reindexing only valid with uniquely valued Index objects
labels.loc[labels['url'] == i, 'category']
list
DataFrame
Series
df1=gold df2=labels m = df1.set_index('url')['category']
0 NaN 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN 8 NaN 9 NaN 10 NaN 11 NaN 12 NaN 13 NaN 14 NaN 15 NaN ...