{ "cells": [ { "cell_type": "code", "execution_count": 4, "id": "056aa255-fda1-4cde-be24-459f6ad2c8b9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3165: DtypeWarning: Columns (4) have mixed types.Specify dtype option on import or set low_memory=False.\n", " has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n" ] } ], "source": [ "import pandas as pd\n", "from bs4 import BeautifulSoup\n", "\n", "df = pd.read_csv('./bq-results-20211206-133858-irtkgx60el7i.csv').drop(['ParentUrl', 'ParentAuthor', 'ParentTime', 'ParentScore'], axis=1)\n", "df.text = df.text.str.replace('
', '\\n')\n", "strings_to_remove = ['rel=\"nofollow\"', '
', '', '', '', '
', '
', '>']\n",
"email_regex = '[a-zA-Z0-9._-]{0,30}@[a-zA-Z0-9._-]{0,20}\\.[a-zA-Z0-9_-]{2,3}'\n",
"munged_url_regex = 'http(s)?:\\&\\#.*?\\<\\/a>'\n",
"\n",
"for string in strings_to_remove:\n",
" df.text = df.text.str.replace(string, '')\n",
"\n",
"\n",
"df.text = df.text.replace(email_regex, 'REDACTED_EMAIL', regex=True)\n",
"df.text = df.text.replace(munged_url_regex, '', regex=True)\n",
"\n",
" # fix some unicode issues\n",
"df.text = df.text.str.replace(''', \"'\")\n",
"df.text = df.text.str.replace('/', \"/\")\n",
"df.text = df.text.str.replace(\""\", '\"')\n",
"\n",
"hiring_df = df[df.ParentTitle.str.lower().str.contains('who is hiring')]\n",
"wants_to_be_hired_df = df[df.ParentTitle.str.lower().str.contains('wants to be hired')]\n",
"freelancer_df = df[df.ParentTitle.str.lower().str.contains('freelancer')]\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "1ee19b74-2085-40d8-b9d2-51b526f4d438",
"metadata": {},
"outputs": [],
"source": [
"import datasets\n",
"from huggingface_hub import create_repo\n",
"from huggingface_hub import Repository"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "57ca7c96-d94c-4e65-8113-da7729558247",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/dan.becker/Desktop/hackernews_hiring_dataset is already a clone of https://huggingface.co/datasets/dansbecker/hackernews_hiring_posts. Make sure you pull the latest changes with `repo.git_pull()`.\n"
]
},
{
"ename": "OSError",
"evalue": "fatal: pathspec 'hackernews_hiring_dataset/data/*' did not match any files\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/usr/local/anaconda3/lib/python3.8/site-packages/huggingface_hub/repository.py\u001b[0m in \u001b[0;36mgit_add\u001b[0;34m(self, pattern, auto_lfs_track)\u001b[0m\n\u001b[1;32m 908\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 909\u001b[0;31m result = subprocess.run(\n\u001b[0m\u001b[1;32m 910\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m\"git\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"add\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"-v\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpattern\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/anaconda3/lib/python3.8/subprocess.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(input, capture_output, timeout, check, *popenargs, **kwargs)\u001b[0m\n\u001b[1;32m 515\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcheck\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mretcode\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 516\u001b[0;31m raise CalledProcessError(retcode, process.args,\n\u001b[0m\u001b[1;32m 517\u001b[0m output=stdout, stderr=stderr)\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command '['git', 'add', '-v', 'hackernews_hiring_dataset/data/*']' returned non-zero exit status 128.",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m