【发布时间】:2021-09-29 18:10:15
【问题描述】:
我有两个具有以下架构的数据框
df1:
root
|-- story_id: string (nullable = true)
|-- uri: string (nullable = true)
df2:
root
|-- uri: string (nullable = true)
这是来自两者的示例数据
df1:
|story_id |uri |
+----------------------------------+---------------------------------------------------------------------------------------------------------------+
|0x5883d731edac1ca0d115c1ef05fb45e3|https://ilovupdates.com/i-know-what-you-did-last-summer-amazon-originals/|
|0x5883d731edac1ca0d115c1ef05fb45e3|https://ilovupdates.com/annabelle-sethupathi-2021-full-movie-download/|
|0x5883d731edac1ca0d115c1ef05fb45e3|https://ilovupdates.com/vicky-kaushal-biography/|
+----------------------------------+---------------------------------------------------------------------------------------------------------------+
df2
+----------------------------------------------------------------------------------+
|uri |
+----------------------------------------------------------------------------------+
|https://tvnewsalert.com/topics/entertainment/ |
|https://tvnewsalert.com/private-vaccine-verification-app-portpass-sparks-privacy-security-concerns/|
|https://tvnewsalert.com/kota-factory-season-2-web-series-download-leaked-on-moviesflix-480p/ |
+----------------------------------------------------------------------------------+
本质上 df1 包含给定故事 ID 的多个 url,并且 df1 中有多个故事 ID。
df2 包含一组主 url。
任务是找出 df1 中每个故事 id 中有多少个 url 存在于 df2 的主 url 集中
所以对于像这样的输入:
df1
s1, url1
s1, url2
s1, url3
s2, url2
s2, url4
df2
url1
url3
url4
输出应该是
s1, 2
s2, 1
【问题讨论】: