{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "import shutil"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "contributing_ranef = pd.read_csv(\"../mlm/data/0207_contributing_dweek_ranefs.csv\")\n",
    "readme_ranef = pd.read_csv(\"../mlm/data/0207_readme_dweek_ranefs.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "contributing_ranef['repo_id'] = contributing_ranef['level']\n",
    "readme_ranef['repo_id'] = readme_ranef['level']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "contributing_manifest = pd.read_csv(\"../validation/020725_CONTRIBUTING_manifest.csv\")\n",
    "readme_manifest = pd.read_csv(\"../validation/020725_README_manifest.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "714"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "contributing_merged = pd.merge(contributing_manifest, contributing_ranef, on=['repo_id'], how='inner')\n",
    "contributing_merged = contributing_merged.drop(columns='Unnamed: 0')\n",
    "contributing_merged.head()\n",
    "len(contributing_merged)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "contributing_merged.to_csv('0207_contributing_merged_manifest.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Empty DataFrame\n",
      "Columns: [repo_id, commits_filepath, fvf_filepath]\n",
      "Index: []\n"
     ]
    }
   ],
   "source": [
    "#duplicates = readme_manifest[readme_manifest.duplicated(subset=['repo_id'], keep=False)]\n",
    "#len(duplicates)\n",
    "#print(duplicates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4226"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "readme_merged = pd.merge(readme_manifest, readme_ranef, on=['repo_id'], how='inner')\n",
    "readme_merged = readme_merged.drop(columns='Unnamed: 0')\n",
    "len(readme_merged)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "readme_merged.to_csv('0207_readme_merged_manifest.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
