{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2024-05-14T15:00:26.015772Z", "start_time": "2024-05-14T15:00:25.963139Z" } }, "source": [ "import pandas as pd\n", "\n", "df_43 = pd.read_csv('/home/gui/hf_dev/datatrove/blogpost/data/top_60k_urls_CC_MAIN_2021_43.csv').sort_values(by=\"Frequency\", ascending=False)\n", "df_49 = pd.read_csv('/home/gui/hf_dev/datatrove/blogpost/data/top_60k_urls_CC_MAIN_2021_49.csv').sort_values(by=\"Frequency\", ascending=False)" ], "outputs": [], "execution_count": 27 }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-14T15:00:27.625974Z", "start_time": "2024-05-14T15:00:26.358729Z" } }, "cell_type": "code", "source": "freqs_49 = {row[1][\"URL\"]: row[1][\"Frequency\"] for row in df_49.iterrows()}", "id": "6a21a1ed442a6d79", "outputs": [], "execution_count": 28 }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-14T15:00:28.029676Z", "start_time": "2024-05-14T15:00:27.626997Z" } }, "cell_type": "code", "source": [ "df_43['in_49'] = df_43.apply(lambda row: freqs_49.get(row[\"URL\"], 0), axis=1)\n", "df_43['change_to_49'] = df_43.apply(lambda row: freqs_49.get(row[\"URL\"], 0) - row[\"Frequency\"], axis=1)" ], "id": "bc7cdf0d04ff0d0", "outputs": [], "execution_count": 29 }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-14T15:00:28.035756Z", "start_time": "2024-05-14T15:00:28.030629Z" } }, "cell_type": "code", "source": "df_43", "id": "990f471d499d7064", "outputs": [ { "data": { "text/plain": [ " URL Frequency in_49 change_to_49\n", "0 worldwidescience.org 0.001337 0.001317 -2.004393e-05\n", "1 issuu.com 0.001006 0.000992 -1.395550e-05\n", "2 en.wikipedia.org 0.000824 0.001125 3.004770e-04\n", "3 caselaw.findlaw.com 0.000661 0.000228 -4.330254e-04\n", "4 www.frontiersin.org 0.000611 0.000402 -2.088168e-04\n", "... ... ... ... ...\n", "59995 www.basketballghana.com 0.000001 0.000002 7.485694e-07\n", "59996 meisendorf.com 0.000001 0.000000 -1.323341e-06\n", "59997 www.anyrubbish.co.uk 0.000001 0.000000 -1.323290e-06\n", "59998 qjshhxx.cn 0.000001 0.000000 -1.323239e-06\n", "59999 www.al-enterprise.com 0.000001 0.000000 -1.323225e-06\n", "\n", "[60000 rows x 4 columns]" ], "text/html": [ "
\n", " | URL | \n", "Frequency | \n", "in_49 | \n", "change_to_49 | \n", "
---|---|---|---|---|
0 | \n", "worldwidescience.org | \n", "0.001337 | \n", "0.001317 | \n", "-2.004393e-05 | \n", "
1 | \n", "issuu.com | \n", "0.001006 | \n", "0.000992 | \n", "-1.395550e-05 | \n", "
2 | \n", "en.wikipedia.org | \n", "0.000824 | \n", "0.001125 | \n", "3.004770e-04 | \n", "
3 | \n", "caselaw.findlaw.com | \n", "0.000661 | \n", "0.000228 | \n", "-4.330254e-04 | \n", "
4 | \n", "www.frontiersin.org | \n", "0.000611 | \n", "0.000402 | \n", "-2.088168e-04 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
59995 | \n", "www.basketballghana.com | \n", "0.000001 | \n", "0.000002 | \n", "7.485694e-07 | \n", "
59996 | \n", "meisendorf.com | \n", "0.000001 | \n", "0.000000 | \n", "-1.323341e-06 | \n", "
59997 | \n", "www.anyrubbish.co.uk | \n", "0.000001 | \n", "0.000000 | \n", "-1.323290e-06 | \n", "
59998 | \n", "qjshhxx.cn | \n", "0.000001 | \n", "0.000000 | \n", "-1.323239e-06 | \n", "
59999 | \n", "www.al-enterprise.com | \n", "0.000001 | \n", "0.000000 | \n", "-1.323225e-06 | \n", "
60000 rows × 4 columns
\n", "\n", " | URL | \n", "Frequency | \n", "in_49 | \n", "change_to_49 | \n", "
---|---|---|---|---|
9 | \n", "ufdc.ufl.edu | \n", "0.000443 | \n", "0.0 | \n", "-0.000443 | \n", "
22 | \n", "www.hotfreebooks.com | \n", "0.000244 | \n", "0.0 | \n", "-0.000244 | \n", "
37 | \n", "irclogs.ubuntu.com | \n", "0.000190 | \n", "0.0 | \n", "-0.000190 | \n", "
47 | \n", "transparentpng.netlify.app | \n", "0.000181 | \n", "0.0 | \n", "-0.000181 | \n", "
85 | \n", "www.preceptaustin.org | \n", "0.000120 | \n", "0.0 | \n", "-0.000120 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
59994 | \n", "www.annahelizabeth.com | \n", "0.000001 | \n", "0.0 | \n", "-0.000001 | \n", "
59996 | \n", "meisendorf.com | \n", "0.000001 | \n", "0.0 | \n", "-0.000001 | \n", "
59997 | \n", "www.anyrubbish.co.uk | \n", "0.000001 | \n", "0.0 | \n", "-0.000001 | \n", "
59998 | \n", "qjshhxx.cn | \n", "0.000001 | \n", "0.0 | \n", "-0.000001 | \n", "
59999 | \n", "www.al-enterprise.com | \n", "0.000001 | \n", "0.0 | \n", "-0.000001 | \n", "
29485 rows × 4 columns
\n", "