last day (15 days later) » 

17:23
I would format that as code so you aren't linking to pornographic websites
$ print gold.head()
yea, lol
the code formatting broke when i tried to add the relevant ccommand
Put it between ``` ```
```
There ya go
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
17:26
So can you explain your output? Should it look up the url in gold and make sure that category equals the category in gold?
with what i had earlier:
  for i in gold['url']:
    labels[labels['url']==i]['category'] == str(gold[gold['url']==i]['category'])
i get a series with the index on labels and a True or False value
example:
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
for each loop
I was trying to figure out how to toss out that first loop and instead make it all one series, so bring the uppermost loop to the numpy compile layer
You don't need a loop
So let's say this is df1:
          url category
0  google.com        G
1   yahoo.com        S
And this is df2
   turk         url category
0     1  google.com        G
1     2   yahoo.com        S
2     3  google.com        S
You would want True True False correct?
yea
turk isnt unique always but basically this
17:31
That's fine, make df1 a mapping series with url as index, so:
m = df1.set_index('url')['category']
Then you just need:
df2.url.map(m) == df2.category
0     True
1     True
2    False
dtype: bool
oh, i see it
This assumes that url is unique in df1
that is the case
were it not though
Missing values will be NaN and will evaluate as False
When compared to df2
That solve your issue?
yea, so one followup since you brought it up, if df1 was not fully uniquef
if you tried to set the index would that fail
override most recent/keep first/etc
17:36
It would let you set the index, but the map would fail.
InvalidIndexError: Reindexing only valid with uniquely valued Index objects
so m would successfully build and id only see the error at df2.url.map(m) == df2.category
Correct
and lastly, while im not using it this is correct syntax for doing the access without chain indexing labels.loc(labels['url']==i,['category'])
labels.loc[labels['url'] == i, 'category']
If you pass a list instead of a label, it will return a DataFrame, not a Series
oh ok, yea that makes sense
thanks, covered all my bases
17:44
happy to help
18:14
@user3483203 so at implementation of this
df1=gold
df2=labels
m = df1.set_index('url')['category']
m ends up returning an NaN series
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
...

last day (15 days later) »