nabilah_argyanti_ardyningrum/Web Scraping MAHI.ipynb
2024-12-31 10:01:23 +07:00

7840 lines
335 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"collapsed_sections": [
"VEShbcVt2GuZ",
"brOafK8PS_ne"
]
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"source": [
"# Import Library and Global Variable"
],
"metadata": {
"id": "nefm9Y5uQ6iu"
}
},
{
"cell_type": "code",
"source": [
"# !pip install beautifulsoup4"
],
"metadata": {
"id": "QuTQj8E6N_2p"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import json\n",
"import numpy as np\n",
"import os\n",
"import pandas as pd\n",
"import random\n",
"import re\n",
"import requests\n",
"import uuid\n",
"import zipfile\n",
"from bs4 import BeautifulSoup"
],
"metadata": {
"id": "YVsVcK90Q5ab"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"id": "NTwBSJh9Q-Kl",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "702f2269-8efd-4c27-c7b6-9b411c02f9ca"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Export file\n",
"def export_array_to_txt(array, filename):\n",
" with open(f\"{filename}.txt\", \"w\") as file:\n",
" file.write(\"\\n\".join(array))\n",
"\n",
"def export_dataframe(df, directory, name):\n",
" if not os.path.exists(directory):\n",
" os.mkdir(directory)\n",
" excel_file_name = directory + '/' + name + '.xlsx'\n",
" df.to_excel(excel_file_name, index=True)\n",
"\n",
" csv_file_name = directory + '/' + name + '.csv'\n",
" df.to_csv(csv_file_name, index=False)\n",
"\n",
"def create_zip_file(directory):\n",
" zip_filename = directory + '.zip'\n",
"\n",
" # create the zip file\n",
" with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zip_file:\n",
" for root, dirs, files in os.walk(directory):\n",
" for file in files:\n",
" file_path = os.path.join(root, file)\n",
" zip_file.write(file_path)\n",
"\n",
" print(f\"{zip_filename} created successfully!\")"
],
"metadata": {
"id": "jVYotZ5HOClQ"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Get Recipe's URL"
],
"metadata": {
"id": "8Oj0q-2iphf8"
}
},
{
"cell_type": "code",
"source": [
"# Function to get recipe's URL from each pages\n",
"def get_recipe_urls(url):\n",
" page = requests.get(url)\n",
" soup = BeautifulSoup(page.content, 'html.parser')\n",
"\n",
" urls = []\n",
" recipe_cards = soup.find_all('div', class_='_recipe-card')\n",
"\n",
" for recipe_card in recipe_cards:\n",
" link_element = recipe_card.find('h3', class_='card-title').find('a')\n",
" urls.append(link_element['href'])\n",
"\n",
" return urls"
],
"metadata": {
"id": "8TF1iISUO0pz"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Get all URL\n",
"recipe_urls = []\n",
"base_url = 'https://www.masakapahariini.com/resep/'\n",
"page_number = 134\n",
"\n",
"for n in range(1, page_number):\n",
" url = base_url if n == 1 else base_url + 'page/' + str(n)\n",
" recipe_urls += get_recipe_urls(url)"
],
"metadata": {
"id": "yPglWH9XO17n"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"recipe_urls"
],
"metadata": {
"id": "naF2ErtqQRvd"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"export_array_to_txt(recipe_urls, \"mahi_urls\")"
],
"metadata": {
"id": "pdx1RNEFxIi_"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Scrapping Data"
],
"metadata": {
"id": "AEOCfQ_Oplaq"
}
},
{
"cell_type": "code",
"source": [
"# Import URL file\n",
"filename = \"/content/drive/MyDrive/EzCook/May 2023/mahi_urls.txt\"\n",
"\n",
"with open(filename, 'r') as file:\n",
" contents = file.read()\n",
" lines = contents.split('\\n')\n",
" recipe_urls = [line.strip() for line in lines]"
],
"metadata": {
"id": "ymoP4lEzyS80"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Check output\n",
"recipe_urls[1]"
],
"metadata": {
"id": "PnNVRsbiy4sI",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "88db328c-14b7-47da-fade-42719f6be0bf"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'https://www.masakapahariini.com/resep/resep-ayam-rendang/'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 6
}
]
},
{
"cell_type": "code",
"source": [
"# Check URL index\n",
"url_to_find = \"https://www.masakapahariini.com/resep/resep-pepes-ikan-mas/\"\n",
"\n",
"try:\n",
" index = recipe_urls.index(url_to_find)\n",
" print(f\"Found URL at index {index}\")\n",
"except ValueError:\n",
" print(f\"URL '{url_to_find}' not found in list\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XLvS_EKjiwcM",
"outputId": "0c556d55-71a2-488a-902f-88d11c5f150e"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Found URL at index 86\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"def generate_id_by_title(df):\n",
" # Get unique titles from dataframe\n",
" unique_titles = df['title'].unique()\n",
"\n",
" # Generate new IDs for each unique title\n",
" new_ids = {title: random.randint(10_000_000_000, 99_999_999_999) for title in unique_titles}\n",
"\n",
" # Check that all new IDs are unique\n",
" while len(set(new_ids.values())) != len(unique_titles):\n",
" # Generate new IDs for any non-unique titles\n",
" for title in unique_titles:\n",
" if new_ids.count(title) > 1:\n",
" new_ids[title] = random.randint(10_000_000_000, 99_999_999_999)\n",
"\n",
" # Map new IDs to dataframe\n",
" df['id'] = df['title'].map(new_ids)\n",
" return df"
],
"metadata": {
"id": "EMvpGw2WyIU1"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"class RecipeScraper:\n",
" def __init__(self):\n",
" self.page = None\n",
" self.soup = None\n",
"\n",
" def get_soup(self, url):\n",
" self.page = requests.get(url)\n",
" self.soup = BeautifulSoup(self.page.content, 'html.parser')\n",
"\n",
" def extract_text(self, scripts):\n",
" return [script.text.strip() for script in scripts]\n",
"\n",
" def extract_amount(self, scripts):\n",
" return [script.get('data-base-quantity') for script in scripts]\n",
"\n",
" def extract_instructions(self, scripts):\n",
" instructions = []\n",
" for instruction in scripts:\n",
" content = instruction.find('div', {'class': 'content'})\n",
" if content.find('p'):\n",
" p_element = content.find('p')\n",
" text = p_element.get_text().strip()\n",
" else:\n",
" text = content.get_text().strip()\n",
" instructions.append(text)\n",
"\n",
" return instructions\n",
"\n",
" def combine_ingredients(self, amounts, ingredients):\n",
" combined = []\n",
" for i in range(len(amounts)):\n",
" data = str(amounts[i]) + \" \" + ingredients[i].replace('\\t', '').replace('\\n', '')\n",
" data = ' '.join(data.split())\n",
" combined.append(data)\n",
" return combined\n",
"\n",
" def scrape_recipe(self, url):\n",
" self.get_soup(url)\n",
"\n",
" title = self.soup.find('title')\n",
" image_url = self.soup.find(\"img\", {\"class\": \"image\"})[\"src\"]\n",
" time = self.soup.find('a', href=lambda href: href and 'time' in href).text.strip()\n",
" servings = self.soup.find(\"div\", {\"id\": \"portions-value\"}).text.strip()\n",
" difficulty = self.soup.find(\"a\", {\"class\": \"icon_difficulty\"}).text.strip()\n",
" calories = self.soup.find(\"a\", {\"class\": \"icon_fire\"}).text.strip() if self.soup.find(\"a\", {\"class\": \"icon_fire\"}) else 0\n",
" ingredients = self.extract_text(self.soup.find_all('div', {'class': 'item'}))\n",
" amount = self.extract_amount(self.soup.find_all('div', {'class': 'part'}))\n",
" ingredients = self.combine_ingredients(amount, ingredients)\n",
" instructions = self.extract_instructions(self.soup.find('div', {'class': '_recipe-steps'}).find_all('div', {'class': 'step'}))\n",
" tags = self.extract_text(self.soup.find_all(\"a\", {\"class\": \"tag\"}))\n",
"\n",
" return {\n",
" 'title': re.split(r\" - | \\| | untuk | yang\", title.text, 1)[0],\n",
" 'image_url': image_url,\n",
" 'time': time,\n",
" 'servings': servings,\n",
" 'calories': calories,\n",
" 'difficulty': difficulty,\n",
" 'ingredients': ingredients,\n",
" 'instructions': instructions,\n",
" 'source_url': url,\n",
" 'tags': tags,\n",
" }\n"
],
"metadata": {
"id": "fHwU4O67H_8i"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"scraper = RecipeScraper()\n",
"df = pd.DataFrame([scraper.scrape_recipe(url) for url in recipe_urls])\n",
"df.drop_duplicates(subset=['title', 'source_url'], inplace=True)\n",
"df.reset_index(drop=True, inplace=True)\n",
"df = generate_id_by_title(df)"
],
"metadata": {
"id": "XFmHrgESKjOc"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df.tail()"
],
"metadata": {
"id": "f_vBsCl636LE"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"export_dataframe(df, 'mahi_raw', 'recipe-raw')\n",
"create_zip_file('mahi_raw')"
],
"metadata": {
"id": "GcVWQAMDop_8",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "ea7284c8-de1b-4472-b4cb-60faed8cf0f2"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_raw.zip created successfully!\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Change the sequence\n",
"df_recipes = df[['id', 'title', 'source_url', 'image_url', 'time', 'servings', 'calories', 'difficulty', 'instructions', 'tags']]\n",
"df_ingredients = df.loc[:, ['id', 'ingredients']]"
],
"metadata": {
"id": "5ajk5Pqj0B1X"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# df_ingredients['ingredients']"
],
"metadata": {
"id": "fOetUk6J1lkk"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_recipes, 'mahi_c1', 'recipes-c1')\n",
"export_dataframe(df_ingredients, 'mahi_c1', 'ingredients-c1')\n",
"\n",
"create_zip_file('mahi_c1')"
],
"metadata": {
"id": "bAeNTS20yWwX",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "d485eae8-e9f9-47c0-fbd8-4b62883dda58"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_c1.zip created successfully!\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Replace Ingredients Value\n"
],
"metadata": {
"id": "3AiBVtamZTBq"
}
},
{
"cell_type": "code",
"source": [
"import ast\n",
"\n",
"# Read file\n",
"df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/June 2023/ingredients-c1.csv', sep=',')\n",
"\n",
"# Replace \"/\"\n",
"df_ingredients['ingredients'] = df_ingredients['ingredients'].apply(lambda x: ast.literal_eval(x))\n",
"df_ingredients = df_ingredients.explode('ingredients')\n",
"df_ingredients['ingredients'] = df_ingredients['ingredients'].str.replace(' / ', '/')\n",
"\n",
"# Reset index\n",
"df_ingredients = df_ingredients.reset_index()\n",
"df_ingredients = df_ingredients.drop('index', axis=1)"
],
"metadata": {
"id": "t0rTzUNFC8j9"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Split amount and ingredients\n",
"df_ingredients[\"amount\"] = df_ingredients[\"ingredients\"].str.extract(r'^(\\d+(?:\\.\\d+)?\\s?\\d*/?\\d*)')\n",
"df_ingredients[\"ingredients\"] = df_ingredients[\"ingredients\"].str.replace(r'^\\d+(?:\\.\\d+)?\\s?\\d*/?\\d*\\s?', '')"
],
"metadata": {
"id": "5TnnYe9H06dS",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "8e0c8b16-db25-4039-9d3e-9cd66c331580"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-21-b174f95239c4>:3: FutureWarning: The default value of regex will change from True to False in a future version.\n",
" df_ingredients[\"ingredients\"] = df_ingredients[\"ingredients\"].str.replace(r'^\\d+(?:\\.\\d+)?\\s?\\d*/?\\d*\\s?', '')\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "DQrFu-3Oy2l9",
"outputId": "3d49b8e0-bfb1-44c9-9e34-c2b5a7ce4774"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount\n",
"0 55496940902 g kentang ukuran besar, kupas 500 \n",
"1 55496940902 sdm Royco Kaldu Jamur 1 \n",
"2 55496940902 siung bawang putih, memarkan 5 \n",
"3 55496940902 L air, untuk merebus 1.5 \n",
"4 55496940902 Minyak, untuk menggoreng 0 "
],
"text/html": [
"\n",
" <div id=\"df-d9c242c9-bbaa-4725-a8e5-9b697876b748\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>g kentang ukuran besar, kupas</td>\n",
" <td>500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>55496940902</td>\n",
" <td>sdm Royco Kaldu Jamur</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55496940902</td>\n",
" <td>siung bawang putih, memarkan</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>55496940902</td>\n",
" <td>L air, untuk merebus</td>\n",
" <td>1.5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>55496940902</td>\n",
" <td>Minyak, untuk menggoreng</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d9c242c9-bbaa-4725-a8e5-9b697876b748')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-d9c242c9-bbaa-4725-a8e5-9b697876b748 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-d9c242c9-bbaa-4725-a8e5-9b697876b748');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 22
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients[\"ingredients\"] = df_ingredients[\"ingredients\"].str.replace(r'\\([^)]*\\)', '')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "dQUsVNVFMjDy",
"outputId": "9b84e783-6865-4d88-8fae-1ed2ffbdc631"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-24-81531e7a1559>:1: FutureWarning: The default value of regex will change from True to False in a future version.\n",
" df_ingredients[\"ingredients\"] = df_ingredients[\"ingredients\"].str.replace(r'\\([^)]*\\)', '')\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# export_dataframe(df_ingredients, 'mahi_ingredients', 'ingredients-c11')\n",
"# create_zip_file('mahi_ingredients')"
],
"metadata": {
"id": "5rau1qhsjEx7"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Replace First Word"
],
"metadata": {
"id": "VEShbcVt2GuZ"
}
},
{
"cell_type": "code",
"source": [
"# df_ingredients[df_ingredients['ingredients'].str.contains('biji')]\n",
"# df_ingredients[df_ingredients['ingredients'].str.split().str[0] == 'cup']\n",
"\n",
"df_satuan = pd.DataFrame(df_ingredients['ingredients'].str.split().str[0].drop_duplicates().values, columns=['satuan'])\n",
"# satuan = df_ingredients['ingredients'].str.split().str[0].drop_duplicates().values\n",
"# satuan.to_excel('satuan.xlsx', index=False)\n",
"# satuan"
],
"metadata": {
"id": "RchH-NrTcsFi"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_satuan"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 423
},
"id": "xGcOWzg6gxTK",
"outputId": "79b098ee-144d-4e0a-eb92-2fb78e2b7484"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" satuan\n",
"0 g\n",
"1 sdm\n",
"2 siung\n",
"3 L\n",
"4 Minyak,\n",
".. ...\n",
"302 Susu\n",
"303 Merica\n",
"304 telur,\n",
"305 Mayones\n",
"306 timun\n",
"\n",
"[307 rows x 1 columns]"
],
"text/html": [
"\n",
" <div id=\"df-a66c2471-efca-4a67-96f2-785d28d3d033\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>satuan</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>g</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>sdm</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>siung</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>L</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Minyak,</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>302</th>\n",
" <td>Susu</td>\n",
" </tr>\n",
" <tr>\n",
" <th>303</th>\n",
" <td>Merica</td>\n",
" </tr>\n",
" <tr>\n",
" <th>304</th>\n",
" <td>telur,</td>\n",
" </tr>\n",
" <tr>\n",
" <th>305</th>\n",
" <td>Mayones</td>\n",
" </tr>\n",
" <tr>\n",
" <th>306</th>\n",
" <td>timun</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>307 rows × 1 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a66c2471-efca-4a67-96f2-785d28d3d033')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-a66c2471-efca-4a67-96f2-785d28d3d033 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-a66c2471-efca-4a67-96f2-785d28d3d033');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 27
}
]
},
{
"cell_type": "code",
"source": [
"code = {\n",
" 'batang': 'batang',\n",
" 'buah': 'buah',\n",
" 'biji': 'biji',\n",
" 'butir': 'butir',\n",
" 'cangkir': 'cangkir',\n",
" 'cc': 'cc',\n",
" 'cm': 'centimeter',\n",
" 'cup': 'cup',\n",
" 'ekor': 'ekor',\n",
" 'g': 'gram',\n",
" 'gelas': 'gelas',\n",
" 'ikat': 'ikat',\n",
" 'kotak': 'kotak',\n",
" 'L': 'liter',\n",
" 'mangkok': 'mangkok',\n",
" 'ml': 'mililiter',\n",
" 'ons': 'ons',\n",
" 'pak': 'pak',\n",
" 'pack': 'pack',\n",
" 'papan': 'papan',\n",
" 'pasang': 'pasang',\n",
" 'piring': 'piring',\n",
" 'porsi': 'porsi',\n",
" 'ruas': 'ruas',\n",
" 'scoop': 'scoop',\n",
" 'sdm': 'sendok makan',\n",
" 'sdt': 'sendok teh',\n",
" 'stik': 'stik',\n",
" 'siung': 'siung',\n",
" 'tetes': 'tetes',\n",
" 'bungkus': 'bungkus',\n",
" 'kg': 'kilogram',\n",
" 'lembar': 'lembar',\n",
" 'potong': 'potong',\n",
" 'sachet': 'sachet',\n",
" 'tangkai': 'tangkai',\n",
"}"
],
"metadata": {
"id": "FP50O7dY-veb"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_unit = pd.DataFrame.from_dict(code, orient='index')\n",
"df_unit = df_unit.reset_index()\n",
"df_unit = df_unit.rename(columns={\"index\": \"code\", 0: \"name\"})\n",
"df_unit['id'] = df_unit.index + 1\n",
"df_unit = df_unit[['id', 'code', 'name']]\n",
"\n",
"# list_satuan.to_excel('satuan.xlsx')\n",
"# list_satuan.to_csv('satuan.csv')"
],
"metadata": {
"id": "4m5q16v0KbOS"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"code_map = df_unit.set_index('code').T.to_dict('index')\n",
"# code_map['id']"
],
"metadata": {
"id": "4A0d_1X6eWjZ"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients['unit_id'] = df_ingredients['ingredients'].str.split(' ').str[0].str.split(',').str[0]\n",
"df_ingredients.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "IUgFyvNuRKZ8",
"outputId": "01c1cc31-970c-40ec-af3a-d39e041eadde"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id\n",
"0 55496940902 g kentang ukuran besar, kupas 500 g\n",
"1 55496940902 sdm Royco Kaldu Jamur 1 sdm\n",
"2 55496940902 siung bawang putih, memarkan 5 siung\n",
"3 55496940902 L air, untuk merebus 1.5 L\n",
"4 55496940902 Minyak, untuk menggoreng 0 Minyak"
],
"text/html": [
"\n",
" <div id=\"df-8f5af0a1-eb15-4f10-ba57-3f2be2909caf\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>g kentang ukuran besar, kupas</td>\n",
" <td>500</td>\n",
" <td>g</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>55496940902</td>\n",
" <td>sdm Royco Kaldu Jamur</td>\n",
" <td>1</td>\n",
" <td>sdm</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55496940902</td>\n",
" <td>siung bawang putih, memarkan</td>\n",
" <td>5</td>\n",
" <td>siung</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>55496940902</td>\n",
" <td>L air, untuk merebus</td>\n",
" <td>1.5</td>\n",
" <td>L</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>55496940902</td>\n",
" <td>Minyak, untuk menggoreng</td>\n",
" <td>0</td>\n",
" <td>Minyak</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8f5af0a1-eb15-4f10-ba57-3f2be2909caf')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-8f5af0a1-eb15-4f10-ba57-3f2be2909caf button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-8f5af0a1-eb15-4f10-ba57-3f2be2909caf');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 49
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients['unit_id'] = df_ingredients['unit_id'].replace({'liter': 'L'}, regex=True)\n",
"df_ingredients['unit_id'] = df_ingredients['unit_id'].replace({'gram': 'g'}, regex=True)\n",
"df_ingredients['unit_id'] = df_ingredients['unit_id'].replace({'gr': 'g'}, regex=True)"
],
"metadata": {
"id": "5qGnFg7OE3Jq"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "cuZY89C8PL8Z",
"outputId": "c4cad841-d0ef-42b1-d8fc-c32f2da98ecc"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id\n",
"0 55496940902 g kentang ukuran besar, kupas 500 g\n",
"1 55496940902 sdm Royco Kaldu Jamur 1 sdm\n",
"2 55496940902 siung bawang putih, memarkan 5 siung\n",
"3 55496940902 L air, untuk merebus 1.5 L\n",
"4 55496940902 Minyak, untuk menggoreng 0 Minyak"
],
"text/html": [
"\n",
" <div id=\"df-3ad8c49b-501f-4d7e-b554-bf95c89afb0f\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>g kentang ukuran besar, kupas</td>\n",
" <td>500</td>\n",
" <td>g</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>55496940902</td>\n",
" <td>sdm Royco Kaldu Jamur</td>\n",
" <td>1</td>\n",
" <td>sdm</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55496940902</td>\n",
" <td>siung bawang putih, memarkan</td>\n",
" <td>5</td>\n",
" <td>siung</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>55496940902</td>\n",
" <td>L air, untuk merebus</td>\n",
" <td>1.5</td>\n",
" <td>L</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>55496940902</td>\n",
" <td>Minyak, untuk menggoreng</td>\n",
" <td>0</td>\n",
" <td>Minyak</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-3ad8c49b-501f-4d7e-b554-bf95c89afb0f')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-3ad8c49b-501f-4d7e-b554-bf95c89afb0f button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-3ad8c49b-501f-4d7e-b554-bf95c89afb0f');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 51
}
]
},
{
"cell_type": "code",
"source": [
"code_map_lower = {k.lower(): v for k, v in code_map['id'].items()}\n",
"df_ingredients['unit_id'] = df_ingredients['unit_id'].astype(str).str.lower().map(code_map_lower)"
],
"metadata": {
"id": "Avu6yI1qUcLb"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "RU7F4gekf5pb",
"outputId": "fa41aef6-5f15-4e6f-b237-cfd06dfa12d7"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id\n",
"0 55496940902 g kentang ukuran besar, kupas 500 10.0\n",
"1 55496940902 sdm Royco Kaldu Jamur 1 26.0\n",
"2 55496940902 siung bawang putih, memarkan 5 29.0\n",
"3 55496940902 L air, untuk merebus 1.5 14.0\n",
"4 55496940902 Minyak, untuk menggoreng 0 NaN"
],
"text/html": [
"\n",
" <div id=\"df-8b020590-8823-4022-9b81-75cd702fcd63\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>g kentang ukuran besar, kupas</td>\n",
" <td>500</td>\n",
" <td>10.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>55496940902</td>\n",
" <td>sdm Royco Kaldu Jamur</td>\n",
" <td>1</td>\n",
" <td>26.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55496940902</td>\n",
" <td>siung bawang putih, memarkan</td>\n",
" <td>5</td>\n",
" <td>29.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>55496940902</td>\n",
" <td>L air, untuk merebus</td>\n",
" <td>1.5</td>\n",
" <td>14.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>55496940902</td>\n",
" <td>Minyak, untuk menggoreng</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8b020590-8823-4022-9b81-75cd702fcd63')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-8b020590-8823-4022-9b81-75cd702fcd63 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-8b020590-8823-4022-9b81-75cd702fcd63');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 53
}
]
},
{
"cell_type": "code",
"source": [
"df_unit"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "qMBx4kw6hB4L",
"outputId": "724c03e7-1d2f-4ad9-ef8b-e38e35f6d1f3"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id code name\n",
"0 1 batang batang\n",
"1 2 buah buah\n",
"2 3 biji biji\n",
"3 4 butir butir\n",
"4 5 cangkir cangkir\n",
"5 6 cc cc\n",
"6 7 cm centimeter\n",
"7 8 cup cup\n",
"8 9 ekor ekor\n",
"9 10 g gram\n",
"10 11 gelas gelas\n",
"11 12 ikat ikat\n",
"12 13 kotak kotak\n",
"13 14 L liter\n",
"14 15 mangkok mangkok\n",
"15 16 ml mililiter\n",
"16 17 ons ons\n",
"17 18 pak pak\n",
"18 19 pack pack\n",
"19 20 papan papan\n",
"20 21 pasang pasang\n",
"21 22 piring piring\n",
"22 23 porsi porsi\n",
"23 24 ruas ruas\n",
"24 25 scoop scoop\n",
"25 26 sdm sendok makan\n",
"26 27 sdt sendok teh\n",
"27 28 stik stik\n",
"28 29 siung siung\n",
"29 30 tetes tetes\n",
"30 31 bungkus bungkus\n",
"31 32 kg kilogram\n",
"32 33 lembar lembar\n",
"33 34 potong potong\n",
"34 35 sachet sachet\n",
"35 36 tangkai tangkai"
],
"text/html": [
"\n",
" <div id=\"df-7061e766-3e1a-4cda-bfb0-df517ceb634b\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>code</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>batang</td>\n",
" <td>batang</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>buah</td>\n",
" <td>buah</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>biji</td>\n",
" <td>biji</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>butir</td>\n",
" <td>butir</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>cangkir</td>\n",
" <td>cangkir</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>6</td>\n",
" <td>cc</td>\n",
" <td>cc</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>7</td>\n",
" <td>cm</td>\n",
" <td>centimeter</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>8</td>\n",
" <td>cup</td>\n",
" <td>cup</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>9</td>\n",
" <td>ekor</td>\n",
" <td>ekor</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10</td>\n",
" <td>g</td>\n",
" <td>gram</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>11</td>\n",
" <td>gelas</td>\n",
" <td>gelas</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>12</td>\n",
" <td>ikat</td>\n",
" <td>ikat</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>13</td>\n",
" <td>kotak</td>\n",
" <td>kotak</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>14</td>\n",
" <td>L</td>\n",
" <td>liter</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>15</td>\n",
" <td>mangkok</td>\n",
" <td>mangkok</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>16</td>\n",
" <td>ml</td>\n",
" <td>mililiter</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>17</td>\n",
" <td>ons</td>\n",
" <td>ons</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>18</td>\n",
" <td>pak</td>\n",
" <td>pak</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>19</td>\n",
" <td>pack</td>\n",
" <td>pack</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>20</td>\n",
" <td>papan</td>\n",
" <td>papan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>21</td>\n",
" <td>pasang</td>\n",
" <td>pasang</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>22</td>\n",
" <td>piring</td>\n",
" <td>piring</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>23</td>\n",
" <td>porsi</td>\n",
" <td>porsi</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>24</td>\n",
" <td>ruas</td>\n",
" <td>ruas</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>25</td>\n",
" <td>scoop</td>\n",
" <td>scoop</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>26</td>\n",
" <td>sdm</td>\n",
" <td>sendok makan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>27</td>\n",
" <td>sdt</td>\n",
" <td>sendok teh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>28</td>\n",
" <td>stik</td>\n",
" <td>stik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>29</td>\n",
" <td>siung</td>\n",
" <td>siung</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>30</td>\n",
" <td>tetes</td>\n",
" <td>tetes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>31</td>\n",
" <td>bungkus</td>\n",
" <td>bungkus</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>32</td>\n",
" <td>kg</td>\n",
" <td>kilogram</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>33</td>\n",
" <td>lembar</td>\n",
" <td>lembar</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>34</td>\n",
" <td>potong</td>\n",
" <td>potong</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>35</td>\n",
" <td>sachet</td>\n",
" <td>sachet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>36</td>\n",
" <td>tangkai</td>\n",
" <td>tangkai</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7061e766-3e1a-4cda-bfb0-df517ceb634b')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-7061e766-3e1a-4cda-bfb0-df517ceb634b button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-7061e766-3e1a-4cda-bfb0-df517ceb634b');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 54
}
]
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_ingredients, 'mahi_c2', 'ingredients-c2')\n",
"export_dataframe(df_unit, 'mahi_c2', 'satuan-c2')\n",
"\n",
"create_zip_file('mahi_c2')"
],
"metadata": {
"id": "mt6nhoQ0ifhu",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "23599649-3b65-476a-a000-67abf6e1e585"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_c2.zip created successfully!\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Drop Unit Name on First Word + Get State"
],
"metadata": {
"id": "GZPICN2u72lW"
}
},
{
"cell_type": "code",
"source": [
"# Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "dGWEnYO573cy",
"outputId": "1e64940e-fe3f-4c88-9d8f-75045a793c40"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Mounted at /content/drive\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np"
],
"metadata": {
"id": "FcLWylT478h2"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"# df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/May 2023/ingredients-c2.csv', sep=',')\n",
"# df_unit = pd.read_csv('/content/drive/MyDrive/EzCook/satuan_c3.csv', sep=',')"
],
"metadata": {
"id": "BR69oLx579Bb"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# if unit id is not null, delete first word\n",
"df_ingredients['ingredients'] = np.where(df_ingredients['unit_id'].notna(), df_ingredients['ingredients'].str.split(n=1).str[1], df_ingredients['ingredients'])"
],
"metadata": {
"id": "pBBQjwvn8e7a"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients['state'] = df_ingredients['ingredients'].str.split(',', n=1).str[1]\n",
"df_ingredients['ingredients'] = df_ingredients['ingredients'].str.split(',', n=1).str[0]"
],
"metadata": {
"id": "_rySVhMq-MIY"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# df_ingredients.head(100)\n",
"df_ingredients[df_ingredients['ingredients'].str.contains('\\u2019')]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "ezUWYPTT-pTL",
"outputId": "630d368d-c861-4cee-9076-adb97c30459a"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount \\\n",
"152 11817808076 Hellmanns Real Mayonnaise 0 \n",
"197 91398292597 Hellmanns Real Mayonnaise 3 \n",
"1084 45168210867 Hellmanns Real Mayonnaise 4 \n",
"1169 86212210256 Hellmanns Real Mayonnaise 5 \n",
"1834 55385763087 Hellmanns Real Mayonnaise 5 \n",
"2209 75802958080 Hellmanns Real Mayonnaise 150 \n",
"2974 77774305212 Hellmanns Real Mayonnaise 4 \n",
"3155 30787072082 Hellmanns Real Mayonnaise 10 \n",
"3662 17939171727 Hellmanns Real Mayonnaise 6 \n",
"3672 90272773374 Walls Classic Vanilla Ice Cream 0 \n",
"3766 77494090168 Walls Chocolate & Vanilla Chocolate Chip 6 \n",
"6065 14326277867 Hellmanns Real Mayonnaise 8 \n",
"6470 99356543707 Hellmanns Real Mayonnaise 100 \n",
"7108 74146229513 Hellmanns Real Mayonnaise 0 \n",
"7574 97812594148 Hellmanns Real Mayonnaise 4 \n",
"7591 31892560731 Walls Neopolitana Ice Cream 2 \n",
"7954 48980956913 Walls Choco Nutty Crunch 1 \n",
"7958 47010691709 Walls Oreo Cookies & Cream Chocolate 1 \n",
"7965 73372921412 Walls Classic Vanilla Ice Cream 1 \n",
"7969 25478379723 Walls Oreo Cookies & Cream Chocolate 50 \n",
"7973 25478379723 Walls Oreo Cookies & Cream Chocolate 0 \n",
"7976 71847371283 Walls Classic Vanilla Ice Cream 3 \n",
"7977 71847371283 secukupnya Walls Classic Vanilla Ice Cream 0 \n",
"7983 38697064040 Walls Neopolitana Ice Cream 2 \n",
"8166 17513523975 Hellmanns Real Mayonnaise 0 \n",
"8222 40285267713 Hellmanns Real Mayonnaise 250 \n",
"8388 36484660339 pint kecil Walls Black Forest Cake 1 \n",
"8391 35932723760 Walls Strawberry Cheesecake Ice Cream 4 \n",
"8405 63651086598 Walls Chocolate & Vanilla Chocolate Chip 2 2 \n",
"8406 56403941042 Walls Chocolate & Vanilla Chocolate Chip 2 \n",
"8783 10891467559 Walls Avocado Choco & Mocha Ice Cream 0 \n",
"8786 19963291667 Walls Neopolitana Ice Cream 3 \n",
"8793 84260007179 Walls Oreo Cookies & Cream Vanilla 2 \n",
"8797 43734217304 Walls Strawberry Cheesecake Ice Cream 2 \n",
"8803 25870770751 Walls Chocolate Deluxe Ice Cream 3 \n",
"8816 52090688195 Walls Solero Trio Ice Cream 3 \n",
"9544 41948787362 Hellmanns Real Mayonnaise 200 \n",
"9661 42335288819 Hellmanns Real Mayonnaise 5 \n",
"9733 45317624667 Hellmanns Real Mayonnaise 0 \n",
"10173 95640120710 Hellmanns Real Mayonnaise 100 \n",
"10408 88680760468 Hellmanns Real Mayonnaise 150 \n",
"10452 82379358987 Hellmanns Real Mayonnaise 2 \n",
"10778 44367984547 Walls Es Dung Dung Kacang Hijau 4 \n",
"11091 15031721909 Walls Es Dung Dung Kacang Merah 400 \n",
"11847 28683873513 Walls Strawberry Cheesecake Ice Cream 2 \n",
"11865 64601005949 Walls Solero Trio Ice Cream 1 \n",
"12448 44336052869 Hellmanns Real Mayonnaise 5 \n",
"14597 81964244958 Hellmanns Real Mayonnaise 3 \n",
"\n",
" unit_id state \n",
"152 NaN NaN \n",
"197 26.0 NaN \n",
"1084 26.0 NaN \n",
"1169 26.0 NaN \n",
"1834 26.0 NaN \n",
"2209 10.0 NaN \n",
"2974 26.0 NaN \n",
"3155 26.0 NaN \n",
"3662 26.0 NaN \n",
"3672 NaN NaN \n",
"3766 25.0 NaN \n",
"6065 26.0 NaN \n",
"6470 10.0 NaN \n",
"7108 NaN NaN \n",
"7574 26.0 NaN \n",
"7591 25.0 NaN \n",
"7954 19.0 NaN \n",
"7958 19.0 NaN \n",
"7965 25.0 NaN \n",
"7969 10.0 NaN \n",
"7973 NaN NaN \n",
"7976 25.0 NaN \n",
"7977 NaN NaN \n",
"7983 25.0 NaN \n",
"8166 NaN NaN \n",
"8222 16.0 NaN \n",
"8388 NaN NaN \n",
"8391 25.0 NaN \n",
"8405 25.0 NaN \n",
"8406 25.0 NaN \n",
"8783 NaN NaN \n",
"8786 25.0 NaN \n",
"8793 25.0 NaN \n",
"8797 25.0 NaN \n",
"8803 25.0 NaN \n",
"8816 25.0 NaN \n",
"9544 10.0 NaN \n",
"9661 26.0 NaN \n",
"9733 NaN NaN \n",
"10173 10.0 NaN \n",
"10408 10.0 NaN \n",
"10452 26.0 NaN \n",
"10778 2.0 NaN \n",
"11091 16.0 NaN \n",
"11847 25.0 NaN \n",
"11865 25.0 NaN \n",
"12448 26.0 NaN \n",
"14597 26.0 NaN "
],
"text/html": [
"\n",
" <div id=\"df-75e6341c-0bbe-4e8a-9212-90b06eb60c93\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>152</th>\n",
" <td>11817808076</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>197</th>\n",
" <td>91398292597</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1084</th>\n",
" <td>45168210867</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1169</th>\n",
" <td>86212210256</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1834</th>\n",
" <td>55385763087</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2209</th>\n",
" <td>75802958080</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2974</th>\n",
" <td>77774305212</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3155</th>\n",
" <td>30787072082</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>10</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3662</th>\n",
" <td>17939171727</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>6</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3672</th>\n",
" <td>90272773374</td>\n",
" <td>Walls Classic Vanilla Ice Cream</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3766</th>\n",
" <td>77494090168</td>\n",
" <td>Walls Chocolate &amp; Vanilla Chocolate Chip</td>\n",
" <td>6</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6065</th>\n",
" <td>14326277867</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>8</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6470</th>\n",
" <td>99356543707</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7108</th>\n",
" <td>74146229513</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7574</th>\n",
" <td>97812594148</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7591</th>\n",
" <td>31892560731</td>\n",
" <td>Walls Neopolitana Ice Cream</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7954</th>\n",
" <td>48980956913</td>\n",
" <td>Walls Choco Nutty Crunch</td>\n",
" <td>1</td>\n",
" <td>19.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7958</th>\n",
" <td>47010691709</td>\n",
" <td>Walls Oreo Cookies &amp; Cream Chocolate</td>\n",
" <td>1</td>\n",
" <td>19.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7965</th>\n",
" <td>73372921412</td>\n",
" <td>Walls Classic Vanilla Ice Cream</td>\n",
" <td>1</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7969</th>\n",
" <td>25478379723</td>\n",
" <td>Walls Oreo Cookies &amp; Cream Chocolate</td>\n",
" <td>50</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7973</th>\n",
" <td>25478379723</td>\n",
" <td>Walls Oreo Cookies &amp; Cream Chocolate</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7976</th>\n",
" <td>71847371283</td>\n",
" <td>Walls Classic Vanilla Ice Cream</td>\n",
" <td>3</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7977</th>\n",
" <td>71847371283</td>\n",
" <td>secukupnya Walls Classic Vanilla Ice Cream</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7983</th>\n",
" <td>38697064040</td>\n",
" <td>Walls Neopolitana Ice Cream</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8166</th>\n",
" <td>17513523975</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8222</th>\n",
" <td>40285267713</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>250</td>\n",
" <td>16.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8388</th>\n",
" <td>36484660339</td>\n",
" <td>pint kecil Walls Black Forest Cake</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8391</th>\n",
" <td>35932723760</td>\n",
" <td>Walls Strawberry Cheesecake Ice Cream</td>\n",
" <td>4</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8405</th>\n",
" <td>63651086598</td>\n",
" <td>Walls Chocolate &amp; Vanilla Chocolate Chip</td>\n",
" <td>2 2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8406</th>\n",
" <td>56403941042</td>\n",
" <td>Walls Chocolate &amp; Vanilla Chocolate Chip</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8783</th>\n",
" <td>10891467559</td>\n",
" <td>Walls Avocado Choco &amp; Mocha Ice Cream</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8786</th>\n",
" <td>19963291667</td>\n",
" <td>Walls Neopolitana Ice Cream</td>\n",
" <td>3</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8793</th>\n",
" <td>84260007179</td>\n",
" <td>Walls Oreo Cookies &amp; Cream Vanilla</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8797</th>\n",
" <td>43734217304</td>\n",
" <td>Walls Strawberry Cheesecake Ice Cream</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8803</th>\n",
" <td>25870770751</td>\n",
" <td>Walls Chocolate Deluxe Ice Cream</td>\n",
" <td>3</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8816</th>\n",
" <td>52090688195</td>\n",
" <td>Walls Solero Trio Ice Cream</td>\n",
" <td>3</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9544</th>\n",
" <td>41948787362</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>200</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9661</th>\n",
" <td>42335288819</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9733</th>\n",
" <td>45317624667</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10173</th>\n",
" <td>95640120710</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10408</th>\n",
" <td>88680760468</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10452</th>\n",
" <td>82379358987</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>2</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10778</th>\n",
" <td>44367984547</td>\n",
" <td>Walls Es Dung Dung Kacang Hijau</td>\n",
" <td>4</td>\n",
" <td>2.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11091</th>\n",
" <td>15031721909</td>\n",
" <td>Walls Es Dung Dung Kacang Merah</td>\n",
" <td>400</td>\n",
" <td>16.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11847</th>\n",
" <td>28683873513</td>\n",
" <td>Walls Strawberry Cheesecake Ice Cream</td>\n",
" <td>2</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11865</th>\n",
" <td>64601005949</td>\n",
" <td>Walls Solero Trio Ice Cream</td>\n",
" <td>1</td>\n",
" <td>25.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12448</th>\n",
" <td>44336052869</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14597</th>\n",
" <td>81964244958</td>\n",
" <td>Hellmanns Real Mayonnaise</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-75e6341c-0bbe-4e8a-9212-90b06eb60c93')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-75e6341c-0bbe-4e8a-9212-90b06eb60c93 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-75e6341c-0bbe-4e8a-9212-90b06eb60c93');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 72
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients[df_ingredients['ingredients'].isnull()]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 143
},
"id": "0c9cub3DN8Bs",
"outputId": "410ca10c-3037-4858-a23e-7129724933d5"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id state\n",
"7448 70143063780 NaN 200 16.0 NaN\n",
"12224 61286500969 NaN 1 27.0 NaN\n",
"22466 63526196777 NaN 3 26.0 NaN"
],
"text/html": [
"\n",
" <div id=\"df-1fbfa144-014d-4c9c-a16d-b7ab96ddf624\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>7448</th>\n",
" <td>70143063780</td>\n",
" <td>NaN</td>\n",
" <td>200</td>\n",
" <td>16.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12224</th>\n",
" <td>61286500969</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>27.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22466</th>\n",
" <td>63526196777</td>\n",
" <td>NaN</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1fbfa144-014d-4c9c-a16d-b7ab96ddf624')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-1fbfa144-014d-4c9c-a16d-b7ab96ddf624 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-1fbfa144-014d-4c9c-a16d-b7ab96ddf624');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 66
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients = df_ingredients.drop([7448, 12224, 22466])"
],
"metadata": {
"id": "cSB4nFmrNoj6"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_ingredients, 'mahi_c3', 'ingredients-c3')\n",
"\n",
"create_zip_file('mahi_c3')"
],
"metadata": {
"id": "R_naIg0w-wtE",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "10d43db8-cb35-4242-c3e9-108918d7dfcf"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_c3.zip created successfully!\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Checkpoint 4\n",
"Buat cari nama bahan aja"
],
"metadata": {
"id": "11A2UDAQaQJP"
}
},
{
"cell_type": "markdown",
"source": [
"# Replace Fraction"
],
"metadata": {
"id": "brOafK8PS_ne"
}
},
{
"cell_type": "code",
"source": [
"# Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"id": "ia9nGD9dQy9B",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "da4a7848-1685-46c9-99c7-2f5c8d894727"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np"
],
"metadata": {
"id": "wmXGIfmoTCY2"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/ingredients-c3.csv', sep=',')\n",
"df_ingredients"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
},
"id": "U6JSTwIPTC93",
"outputId": "c2a1d5cf-cd1f-46df-8147-ca4f648a5b11"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id \\\n",
"0 19667128120 Daun pisang NaN NaN \n",
"1 19667128120 Minyak NaN NaN \n",
"2 19667128120 Tepung ketan NaN NaN \n",
"3 19667128120 tepung ketan 300 9.0 \n",
"4 19667128120 Buavita Guava 200 13.0 \n",
"... ... ... ... ... \n",
"21035 69526158105 garam ½ 20.0 \n",
"21036 69526158105 minyak sayur 1 19.0 \n",
"21037 69526158105 daun bawang 1 1.0 \n",
"21038 69526158105 seledri 1 1.0 \n",
"21039 69526158105 bawang merah goreng NaN NaN \n",
"\n",
" state \n",
"0 gunting mengikuti ukuran cetakan kue ku \n",
"1 untuk olesan \n",
"2 untuk taburan \n",
"3 NaN \n",
"4 NaN \n",
"... ... \n",
"21035 NaN \n",
"21036 NaN \n",
"21037 iris tipis \n",
"21038 iris tipis \n",
"21039 NaN \n",
"\n",
"[21040 rows x 5 columns]"
],
"text/html": [
"\n",
" <div id=\"df-22935f74-044b-4cc0-a6c7-db7da87f3a14\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>19667128120</td>\n",
" <td>Daun pisang</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>gunting mengikuti ukuran cetakan kue ku</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>19667128120</td>\n",
" <td>Minyak</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk olesan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>19667128120</td>\n",
" <td>Tepung ketan</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk taburan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>19667128120</td>\n",
" <td>tepung ketan</td>\n",
" <td>300</td>\n",
" <td>9.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>19667128120</td>\n",
" <td>Buavita Guava</td>\n",
" <td>200</td>\n",
" <td>13.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21035</th>\n",
" <td>69526158105</td>\n",
" <td>garam</td>\n",
" <td>½</td>\n",
" <td>20.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21036</th>\n",
" <td>69526158105</td>\n",
" <td>minyak sayur</td>\n",
" <td>1</td>\n",
" <td>19.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21037</th>\n",
" <td>69526158105</td>\n",
" <td>daun bawang</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21038</th>\n",
" <td>69526158105</td>\n",
" <td>seledri</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21039</th>\n",
" <td>69526158105</td>\n",
" <td>bawang merah goreng</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21040 rows × 5 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-22935f74-044b-4cc0-a6c7-db7da87f3a14')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-22935f74-044b-4cc0-a6c7-db7da87f3a14 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-22935f74-044b-4cc0-a6c7-db7da87f3a14');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 138
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients['amount'][df_ingredients['amount'].isin([\"½\"])] = 0.5\n",
"df_ingredients['amount'][df_ingredients['amount'].isin([\"⅓\"])] = 0.33\n",
"df_ingredients['amount'][df_ingredients['amount'].isin([\"¼\"])] = 0.25\n",
"df_ingredients['amount'][df_ingredients['amount'].isin([\"⅛\"])] = 0.125\n",
"df_ingredients['amount'][df_ingredients['amount'].isin([\"¾\"])] = 0.75"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QgHf-e6PTGed",
"outputId": "726aa271-be91-4016-9731-d220e8de5317"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" \"\"\"Entry point for launching an IPython kernel.\n",
"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:2: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" \n",
"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:3: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" This is separate from the ipykernel package so we can avoid doing imports until\n",
"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" after removing the cwd from sys.path.\n",
"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:5: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" \"\"\"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"df_ingredients"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
},
"id": "UMyFgRd2TyDl",
"outputId": "5ae969cb-e523-46ca-d260-81b2d5d1078a"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id ingredients amount unit_id \\\n",
"0 19667128120 Daun pisang NaN NaN \n",
"1 19667128120 Minyak NaN NaN \n",
"2 19667128120 Tepung ketan NaN NaN \n",
"3 19667128120 tepung ketan 300 9.0 \n",
"4 19667128120 Buavita Guava 200 13.0 \n",
"... ... ... ... ... \n",
"21035 69526158105 garam 0.5 20.0 \n",
"21036 69526158105 minyak sayur 1 19.0 \n",
"21037 69526158105 daun bawang 1 1.0 \n",
"21038 69526158105 seledri 1 1.0 \n",
"21039 69526158105 bawang merah goreng NaN NaN \n",
"\n",
" state \n",
"0 gunting mengikuti ukuran cetakan kue ku \n",
"1 untuk olesan \n",
"2 untuk taburan \n",
"3 NaN \n",
"4 NaN \n",
"... ... \n",
"21035 NaN \n",
"21036 NaN \n",
"21037 iris tipis \n",
"21038 iris tipis \n",
"21039 NaN \n",
"\n",
"[21040 rows x 5 columns]"
],
"text/html": [
"\n",
" <div id=\"df-eda14541-5ccb-41b3-aabf-fa79fbf92117\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>ingredients</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>19667128120</td>\n",
" <td>Daun pisang</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>gunting mengikuti ukuran cetakan kue ku</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>19667128120</td>\n",
" <td>Minyak</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk olesan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>19667128120</td>\n",
" <td>Tepung ketan</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk taburan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>19667128120</td>\n",
" <td>tepung ketan</td>\n",
" <td>300</td>\n",
" <td>9.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>19667128120</td>\n",
" <td>Buavita Guava</td>\n",
" <td>200</td>\n",
" <td>13.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21035</th>\n",
" <td>69526158105</td>\n",
" <td>garam</td>\n",
" <td>0.5</td>\n",
" <td>20.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21036</th>\n",
" <td>69526158105</td>\n",
" <td>minyak sayur</td>\n",
" <td>1</td>\n",
" <td>19.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21037</th>\n",
" <td>69526158105</td>\n",
" <td>daun bawang</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21038</th>\n",
" <td>69526158105</td>\n",
" <td>seledri</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21039</th>\n",
" <td>69526158105</td>\n",
" <td>bawang merah goreng</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21040 rows × 5 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-eda14541-5ccb-41b3-aabf-fa79fbf92117')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-eda14541-5ccb-41b3-aabf-fa79fbf92117 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-eda14541-5ccb-41b3-aabf-fa79fbf92117');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 140
}
]
},
{
"cell_type": "code",
"source": [
"save_file(df_ingredients, 'ingredients-c4')"
],
"metadata": {
"id": "n4o8JfReUkOs"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "u7fUVLKMV4ek"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Splitting Judul"
],
"metadata": {
"id": "JMlZwt2YZkf9"
}
},
{
"cell_type": "code",
"source": [
"# Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "8EGW9YvBZkIx",
"outputId": "30e8be47-70b1-4101-ff28-cbb73acb6ee8"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np"
],
"metadata": {
"id": "0EM_MGYgZ5Tq"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"df_recipes = pd.read_csv('/content/drive/MyDrive/EzCook/June 2023/recipes-c1.csv', sep=',')\n",
"df_recipes.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 756
},
"id": "5bnQHzhNZ6N-",
"outputId": "e1ff5546-c7d8-4ac5-8f1d-5b3fbc320235"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Cara Membuat Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Resep Rendang Ayam \n",
"2 44391341104 Resep Nastar Lembut Anti Gagal \n",
"3 22338165911 Resep Putri Salju Kacang Mede \n",
"4 33862184532 Resep Es Cincau Gula Aren Segar dan Kaya Serat \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"\n",
" image_url time servings \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 1j 30mnt 4 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 2jam 6 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 2jam 8 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 1j 30mnt 8 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 30mnt 4 \n",
"\n",
" calories difficulty instructions \\\n",
"0 0 Cukup Rumit ['Potong kentang memanjang seperti ukuran kent... \n",
"1 557Kkal Cukup Rumit ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 0 Cukup Rumit ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 0 Cukup Rumit ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 0 Mudah ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"\n",
" tags \n",
"0 ['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom... \n",
"1 ['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi... \n",
"2 ['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ... \n",
"3 ['Cukup Rumit', 'Panggang'] \n",
"4 ['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak... "
],
"text/html": [
"\n",
" <div id=\"df-0bb21c1b-5cd9-4503-8a49-33f868b5f025\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>source_url</th>\n",
" <th>image_url</th>\n",
" <th>time</th>\n",
" <th>servings</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>tags</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Cara Membuat Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>1j 30mnt</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Resep Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>2jam</td>\n",
" <td>6</td>\n",
" <td>557Kkal</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Resep Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>2jam</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Resep Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>1j 30mnt</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>['Cukup Rumit', 'Panggang']</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Resep Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30mnt</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-0bb21c1b-5cd9-4503-8a49-33f868b5f025')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-0bb21c1b-5cd9-4503-8a49-33f868b5f025 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-0bb21c1b-5cd9-4503-8a49-33f868b5f025');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 108
}
]
},
{
"cell_type": "code",
"source": [
"df_recipes['title'] = df_recipes['title'].str.split(',', n=1).str[0]\n",
"df_recipes['title'] = df_recipes['title'].str.split('yang', n=1).str[0]"
],
"metadata": {
"id": "-qx_C2BhaJ0k"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes['title'][df_recipes['title'].str.contains(\"Resep\")] = df_recipes['title'].str.split('Resep', n=1).str[1]\n",
"df_recipes['title'][df_recipes['title'].str.contains(\"Cara Memasak\")] = df_recipes['title'].str.split('Cara Memasak', n=1).str[1]\n",
"df_recipes['title'][df_recipes['title'].str.contains(\"Cara Masak\")] = df_recipes['title'].str.split('Cara Masak', n=1).str[1]\n",
"df_recipes['title'][df_recipes['title'].str.contains(\"Cara Membuat\")] = df_recipes['title'].str.split('Membuat', n=1).str[1]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "XIvn9j-HjFX5",
"outputId": "fbf174bc-bb6e-4cf9-de8a-beaacdb26eb9"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-110-403f1ba391fc>:1: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['title'][df_recipes['title'].str.contains(\"Resep\")] = df_recipes['title'].str.split('Resep', n=1).str[1]\n",
"<ipython-input-110-403f1ba391fc>:2: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['title'][df_recipes['title'].str.contains(\"Cara Memasak\")] = df_recipes['title'].str.split('Cara Memasak', n=1).str[1]\n",
"<ipython-input-110-403f1ba391fc>:3: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['title'][df_recipes['title'].str.contains(\"Cara Masak\")] = df_recipes['title'].str.split('Cara Masak', n=1).str[1]\n",
"<ipython-input-110-403f1ba391fc>:4: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['title'][df_recipes['title'].str.contains(\"Cara Membuat\")] = df_recipes['title'].str.split('Membuat', n=1).str[1]\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"df_recipes['calories'] = df_recipes['calories'].str.split('Kkal', n=1).str[0]"
],
"metadata": {
"id": "kqbGEt4Yd4tc"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes.at[308, 'time'] = '1jam'\n",
"df_recipes.at[961, 'time'] = '1jam'\n",
"df_recipes.at[1414, 'time'] = '30mnt'\n",
"df_recipes.at[1427, 'time'] = '30mnt'\n",
"df_recipes.at[1531, 'time'] = '1jam'"
],
"metadata": {
"id": "J1NVQZgYe8qA"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes['time'] = df_recipes['time'].str.split('mnt', n=1).str[0]"
],
"metadata": {
"id": "BEAqQfpFeNAt"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes['jam'] = 0"
],
"metadata": {
"id": "DRCAB0o9eiBh"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes['jam'][df_recipes['time'].str.contains(\"jam|j\")] = df_recipes['time'].str.split('jam|j', n=1).str[0]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "AisFgV-3ffVE",
"outputId": "646584ed-adf7-48c8-eb81-6a97a677c89b"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-115-128a08d1c545>:1: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['jam'][df_recipes['time'].str.contains(\"jam|j\")] = df_recipes['time'].str.split('jam|j', n=1).str[0]\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"df_recipes['time'][df_recipes['time'].str.contains(\"jam|j\")] = df_recipes['time'].str.split('jam|j', n=1).str[1]\n",
"df_recipes['time'][df_recipes[\"time\"] == ''] = 0"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "GGLzXH5ehR2l",
"outputId": "671c3df8-ae90-4c71-ae94-b24bf55b6562"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-116-97ff91bea76e>:1: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['time'][df_recipes['time'].str.contains(\"jam|j\")] = df_recipes['time'].str.split('jam|j', n=1).str[1]\n",
"<ipython-input-116-97ff91bea76e>:2: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['time'][df_recipes[\"time\"] == ''] = 0\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"df_recipes.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 704
},
"id": "y43OEOHlIYWp",
"outputId": "ee7ead2c-c327-4c66-f6d0-e39f3aa7357e"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Rendang Ayam \n",
"2 44391341104 Nastar Lembut Anti Gagal \n",
"3 22338165911 Putri Salju Kacang Mede \n",
"4 33862184532 Es Cincau Gula Aren Segar dan Kaya Serat \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"\n",
" image_url time servings calories \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 30 4 0 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 0 6 557 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 0 8 0 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 30 8 0 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 30 4 0 \n",
"\n",
" difficulty instructions \\\n",
"0 Cukup Rumit ['Potong kentang memanjang seperti ukuran kent... \n",
"1 Cukup Rumit ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 Cukup Rumit ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 Cukup Rumit ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 Mudah ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"\n",
" tags jam \n",
"0 ['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom... 1 \n",
"1 ['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi... 2 \n",
"2 ['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ... 2 \n",
"3 ['Cukup Rumit', 'Panggang'] 1 \n",
"4 ['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak... 0 "
],
"text/html": [
"\n",
" <div id=\"df-f35098d4-6059-4824-89cb-ac0c7b7bfd05\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>source_url</th>\n",
" <th>image_url</th>\n",
" <th>time</th>\n",
" <th>servings</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>tags</th>\n",
" <th>jam</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>0</td>\n",
" <td>6</td>\n",
" <td>557</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>0</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>['Cukup Rumit', 'Panggang']</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak...</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f35098d4-6059-4824-89cb-ac0c7b7bfd05')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-f35098d4-6059-4824-89cb-ac0c7b7bfd05 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-f35098d4-6059-4824-89cb-ac0c7b7bfd05');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 117
}
]
},
{
"cell_type": "code",
"source": [
"df_recipes['time'] = df_recipes['time'].astype(\"int32\") + (df_recipes['jam'].astype(\"int32\") * 60)"
],
"metadata": {
"id": "4KkoZe73h5mo"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes['image_url'].loc[df_recipes['image_url'] == \"-\"] = 'default.jpg'"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ABUVcMhWe6sQ",
"outputId": "908e330c-0ac2-4ad3-a965-c0901d511845"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-120-75bf49edc3c3>:1: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_recipes['image_url'].loc[df_recipes['image_url'] == \"-\"] = 'default.jpg'\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# df_recipes['img_url'].loc[df_recipes['img_url'] == \"-\"] = 'default.jpg'"
],
"metadata": {
"id": "D0DjUuf1fP8P"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!pip install python-slugify"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "FVO7YPt3faxF",
"outputId": "7187bd21-339d-436b-a091-109e74d8977e"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: python-slugify in /usr/local/lib/python3.10/dist-packages (8.0.1)\n",
"Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.10/dist-packages (from python-slugify) (1.3)\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"from slugify import slugify\n",
"df_recipes['slug'] = df_recipes['title'].apply(lambda x :slugify(x))"
],
"metadata": {
"id": "UgF3ehzXfdap"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "R1H29-HLdrDT",
"outputId": "ce3d0838-588f-4703-aeb4-29a70e0aaab6"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Rendang Ayam \n",
"2 44391341104 Nastar Lembut Anti Gagal \n",
"3 22338165911 Putri Salju Kacang Mede \n",
"4 33862184532 Es Cincau Gula Aren Segar dan Kaya Serat \n",
"... ... ... \n",
"1587 25620239892 Oseng-oseng Buncis \n",
"1588 56963177846 Bakwan Sayur Renyah Tahan Lama \n",
"1589 26253073220 Ayam Bakar Bumbu Rujak \n",
"1590 85439463789 Martabak Mie Telur Kornet \n",
"1591 98956365905 Bubur Ayam Hainan Menyehatkan \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"... ... \n",
"1587 https://www.masakapahariini.com/resep/resep-os... \n",
"1588 https://www.masakapahariini.com/resep/resep-ba... \n",
"1589 https://www.masakapahariini.com/resep/resep-ay... \n",
"1590 https://www.masakapahariini.com/resep/resep-ma... \n",
"1591 https://www.masakapahariini.com/resep/resep-bu... \n",
"\n",
" image_url time servings \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 90 4 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 120 6 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 120 8 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 90 8 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 30 4 \n",
"... ... ... ... \n",
"1587 https://www.masakapahariini.com/wp-content/upl... 25 2 \n",
"1588 https://www.masakapahariini.com/wp-content/upl... 45 4 \n",
"1589 https://www.masakapahariini.com/wp-content/upl... 75 4 \n",
"1590 https://www.masakapahariini.com/wp-content/upl... 25 4 \n",
"1591 https://www.masakapahariini.com/wp-content/upl... 45 4 \n",
"\n",
" calories difficulty instructions \\\n",
"0 0 Cukup Rumit ['Potong kentang memanjang seperti ukuran kent... \n",
"1 557 Cukup Rumit ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 0 Cukup Rumit ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 0 Cukup Rumit ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 0 Mudah ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"... ... ... ... \n",
"1587 334 Mudah ['Panaskan wajan dan minyak. Tumis bawang puti... \n",
"1588 0 Mudah ['Di dalam wadah: aduk tepung terigu, Royco Ka... \n",
"1589 0 Mudah ['Bumbui ayam dengan sedikit garam, lalu pangg... \n",
"1590 139 Mudah ['Campurkan Royco Kaldu Sapi, telur, mie, korn... \n",
"1591 212 Mudah ['Panaskan minyak, tumis bawang putih dan jahe... \n",
"\n",
" tags jam \\\n",
"0 ['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom... 1 \n",
"1 ['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi... 2 \n",
"2 ['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ... 2 \n",
"3 ['Cukup Rumit', 'Panggang'] 1 \n",
"4 ['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak... 0 \n",
"... ... .. \n",
"1587 ['Tumis', 'Manis', 'Tidak Pedas', 'Sedikit Ped... 0 \n",
"1588 ['Tidak Pedas', 'Goreng', 'Gurih', 'Kompor', '... 0 \n",
"1589 ['Ayam', 'Manis', 'Cukup Rumit', 'Gurih', 'Sed... 1 \n",
"1590 ['Tidak Pedas', 'Goreng', 'Gurih', 'Sahur', 'K... 0 \n",
"1591 ['Ayam', 'Tidak Pedas', 'Rebus', 'Kompor', 'Se... 0 \n",
"\n",
" slug \n",
"0 kentang-goreng-renyah-tahan-lama \n",
"1 rendang-ayam \n",
"2 nastar-lembut-anti-gagal \n",
"3 putri-salju-kacang-mede \n",
"4 es-cincau-gula-aren-segar-dan-kaya-serat \n",
"... ... \n",
"1587 oseng-oseng-buncis \n",
"1588 bakwan-sayur-renyah-tahan-lama \n",
"1589 ayam-bakar-bumbu-rujak \n",
"1590 martabak-mie-telur-kornet \n",
"1591 bubur-ayam-hainan-menyehatkan \n",
"\n",
"[1592 rows x 12 columns]"
],
"text/html": [
"\n",
" <div id=\"df-34d131a3-a765-4413-8375-c3cba8351b1d\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>source_url</th>\n",
" <th>image_url</th>\n",
" <th>time</th>\n",
" <th>servings</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>tags</th>\n",
" <th>jam</th>\n",
" <th>slug</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>90</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>['Tidak Pedas', 'Low', 'Goreng', 'Gurih', 'Kom...</td>\n",
" <td>1</td>\n",
" <td>kentang-goreng-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>120</td>\n",
" <td>6</td>\n",
" <td>557</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>['Tumis', 'Ayam', 'Kurang dari 5 bahan', 'Medi...</td>\n",
" <td>2</td>\n",
" <td>rendang-ayam</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>120</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>['Manis', 'Tidak Pedas', 'Low', 'Asam', 'Idul ...</td>\n",
" <td>2</td>\n",
" <td>nastar-lembut-anti-gagal</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>90</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>['Cukup Rumit', 'Panggang']</td>\n",
" <td>1</td>\n",
" <td>putri-salju-kacang-mede</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>['Minuman', 'Low', 'Manis', 'Appetizer', 'Prak...</td>\n",
" <td>0</td>\n",
" <td>es-cincau-gula-aren-segar-dan-kaya-serat</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1587</th>\n",
" <td>25620239892</td>\n",
" <td>Oseng-oseng Buncis</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-os...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>25</td>\n",
" <td>2</td>\n",
" <td>334</td>\n",
" <td>Mudah</td>\n",
" <td>['Panaskan wajan dan minyak. Tumis bawang puti...</td>\n",
" <td>['Tumis', 'Manis', 'Tidak Pedas', 'Sedikit Ped...</td>\n",
" <td>0</td>\n",
" <td>oseng-oseng-buncis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1588</th>\n",
" <td>56963177846</td>\n",
" <td>Bakwan Sayur Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ba...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>45</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Di dalam wadah: aduk tepung terigu, Royco Ka...</td>\n",
" <td>['Tidak Pedas', 'Goreng', 'Gurih', 'Kompor', '...</td>\n",
" <td>0</td>\n",
" <td>bakwan-sayur-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1589</th>\n",
" <td>26253073220</td>\n",
" <td>Ayam Bakar Bumbu Rujak</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>75</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Bumbui ayam dengan sedikit garam, lalu pangg...</td>\n",
" <td>['Ayam', 'Manis', 'Cukup Rumit', 'Gurih', 'Sed...</td>\n",
" <td>1</td>\n",
" <td>ayam-bakar-bumbu-rujak</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1590</th>\n",
" <td>85439463789</td>\n",
" <td>Martabak Mie Telur Kornet</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ma...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>25</td>\n",
" <td>4</td>\n",
" <td>139</td>\n",
" <td>Mudah</td>\n",
" <td>['Campurkan Royco Kaldu Sapi, telur, mie, korn...</td>\n",
" <td>['Tidak Pedas', 'Goreng', 'Gurih', 'Sahur', 'K...</td>\n",
" <td>0</td>\n",
" <td>martabak-mie-telur-kornet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Bubur Ayam Hainan Menyehatkan</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-bu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>45</td>\n",
" <td>4</td>\n",
" <td>212</td>\n",
" <td>Mudah</td>\n",
" <td>['Panaskan minyak, tumis bawang putih dan jahe...</td>\n",
" <td>['Ayam', 'Tidak Pedas', 'Rebus', 'Kompor', 'Se...</td>\n",
" <td>0</td>\n",
" <td>bubur-ayam-hainan-menyehatkan</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1592 rows × 12 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-34d131a3-a765-4413-8375-c3cba8351b1d')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-34d131a3-a765-4413-8375-c3cba8351b1d button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-34d131a3-a765-4413-8375-c3cba8351b1d');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 126
}
]
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_ingredients, 'mahi_c3', 'ingredients-c3')\n",
"\n",
"create_zip_file('mahi_c3')"
],
"metadata": {
"id": "uJ0c3QFYpnrQ"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Replace urutan"
],
"metadata": {
"id": "WGjg0gcgXnWF"
}
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np"
],
"metadata": {
"id": "6zbWEmRzYAUT"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Mount Google Drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "WQ5u31g2pvOK",
"outputId": "d1d876a9-24d7-4c05-c2f3-7eb40575330e"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"# df_recipes = pd.read_csv('/content/drive/MyDrive/EzCook/2023/recipes-c1.csv', sep=',')\n",
"df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/June 2023/ingredients-c3.csv', sep=',')"
],
"metadata": {
"id": "Gn71rk9Opvt0"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# df_recipes = df_recipes.drop([386, 831])"
],
"metadata": {
"id": "BGSE_Jmuq95R"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes = df_recipes[['id', 'title', 'source_url', 'image_url', 'servings', 'time', 'calories', 'difficulty', 'instructions', 'slug']]"
],
"metadata": {
"id": "0vImJrSarO9M"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 634
},
"id": "PTBIQZhrr7yG",
"outputId": "4093e2b9-67e4-40ae-bea2-335dcbdf354c"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Rendang Ayam \n",
"2 44391341104 Nastar Lembut Anti Gagal \n",
"3 22338165911 Putri Salju Kacang Mede \n",
"4 33862184532 Es Cincau Gula Aren Segar dan Kaya Serat \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"\n",
" image_url servings time calories \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 4 90 0 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 6 120 557 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 8 120 0 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 8 90 0 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 4 30 0 \n",
"\n",
" difficulty instructions \\\n",
"0 Cukup Rumit ['Potong kentang memanjang seperti ukuran kent... \n",
"1 Cukup Rumit ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 Cukup Rumit ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 Cukup Rumit ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 Mudah ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"\n",
" slug \n",
"0 kentang-goreng-renyah-tahan-lama \n",
"1 rendang-ayam \n",
"2 nastar-lembut-anti-gagal \n",
"3 putri-salju-kacang-mede \n",
"4 es-cincau-gula-aren-segar-dan-kaya-serat "
],
"text/html": [
"\n",
" <div id=\"df-38d1ca26-24bd-4428-a79b-78c2e2219aef\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>source_url</th>\n",
" <th>image_url</th>\n",
" <th>servings</th>\n",
" <th>time</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>slug</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>4</td>\n",
" <td>90</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>kentang-goreng-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>6</td>\n",
" <td>120</td>\n",
" <td>557</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>rendang-ayam</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>8</td>\n",
" <td>120</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>nastar-lembut-anti-gagal</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>8</td>\n",
" <td>90</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>putri-salju-kacang-mede</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>4</td>\n",
" <td>30</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>es-cincau-gula-aren-segar-dan-kaya-serat</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-38d1ca26-24bd-4428-a79b-78c2e2219aef')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-38d1ca26-24bd-4428-a79b-78c2e2219aef button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-38d1ca26-24bd-4428-a79b-78c2e2219aef');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 146
}
]
},
{
"cell_type": "code",
"source": [
"# df_recipes.rename(columns = {'steps':'instructions', 'url':'source_url'}, inplace = True)"
],
"metadata": {
"id": "gHA2cfp9sGpp"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients.rename(columns = {'id':'recipe_id', 'ingredients': 'name'}, inplace = True)"
],
"metadata": {
"id": "6mElCeSotJRl"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients['id'] = df_ingredients.index + 1"
],
"metadata": {
"id": "kmyCLpHVtSEU"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients = df_ingredients[['id', 'name', 'recipe_id', 'amount', 'unit_id', 'state']]"
],
"metadata": {
"id": "vjwbkQfPs-_S"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 423
},
"id": "Q_oPzHvdsw2j",
"outputId": "5934c233-814e-4dde-85a1-5d333d64b946"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id name recipe_id amount unit_id \\\n",
"0 1 kentang ukuran besar 55496940902 500 10.0 \n",
"1 2 Royco Kaldu Jamur 55496940902 1 26.0 \n",
"2 3 bawang putih 55496940902 5 29.0 \n",
"3 4 air 55496940902 1.5 14.0 \n",
"4 5 Minyak 55496940902 0 NaN \n",
"... ... ... ... ... ... \n",
"22601 22602 garam 98956365905 1/2 27.0 \n",
"22602 22603 minyak sayur 98956365905 1 26.0 \n",
"22603 22604 daun bawang 98956365905 1 1.0 \n",
"22604 22605 seledri 98956365905 1 1.0 \n",
"22605 22606 bawang merah goreng 98956365905 0 NaN \n",
"\n",
" state \n",
"0 kupas \n",
"1 NaN \n",
"2 memarkan \n",
"3 untuk merebus \n",
"4 untuk menggoreng \n",
"... ... \n",
"22601 NaN \n",
"22602 NaN \n",
"22603 iris tipis \n",
"22604 iris tipis \n",
"22605 NaN \n",
"\n",
"[22606 rows x 6 columns]"
],
"text/html": [
"\n",
" <div id=\"df-ba81a12c-034a-418a-8655-d93d517e3e85\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>recipe_id</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>kentang ukuran besar</td>\n",
" <td>55496940902</td>\n",
" <td>500</td>\n",
" <td>10.0</td>\n",
" <td>kupas</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Royco Kaldu Jamur</td>\n",
" <td>55496940902</td>\n",
" <td>1</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>bawang putih</td>\n",
" <td>55496940902</td>\n",
" <td>5</td>\n",
" <td>29.0</td>\n",
" <td>memarkan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>air</td>\n",
" <td>55496940902</td>\n",
" <td>1.5</td>\n",
" <td>14.0</td>\n",
" <td>untuk merebus</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Minyak</td>\n",
" <td>55496940902</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>untuk menggoreng</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22601</th>\n",
" <td>22602</td>\n",
" <td>garam</td>\n",
" <td>98956365905</td>\n",
" <td>1/2</td>\n",
" <td>27.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22602</th>\n",
" <td>22603</td>\n",
" <td>minyak sayur</td>\n",
" <td>98956365905</td>\n",
" <td>1</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22603</th>\n",
" <td>22604</td>\n",
" <td>daun bawang</td>\n",
" <td>98956365905</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22604</th>\n",
" <td>22605</td>\n",
" <td>seledri</td>\n",
" <td>98956365905</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22605</th>\n",
" <td>22606</td>\n",
" <td>bawang merah goreng</td>\n",
" <td>98956365905</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>22606 rows × 6 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-ba81a12c-034a-418a-8655-d93d517e3e85')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-ba81a12c-034a-418a-8655-d93d517e3e85 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-ba81a12c-034a-418a-8655-d93d517e3e85');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 139
}
]
},
{
"cell_type": "code",
"source": [
"df_tags = df_recipes[['id', 'tags']]\n",
"df_tags['tags'] = df_tags['tags'].apply(lambda x: ast.literal_eval(x))\n",
"df_tags = df_tags.explode('tags')\n",
"df_tags"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 527
},
"id": "2bsXxkc2jcR3",
"outputId": "580cff9d-449b-416f-e78b-356dfa5b4a4c"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"<ipython-input-144-a9f344867537>:2: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" df_tags['tags'] = df_tags['tags'].apply(lambda x: ast.literal_eval(x))\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id tags\n",
"0 55496940902 Tidak Pedas\n",
"0 55496940902 Low\n",
"0 55496940902 Goreng\n",
"0 55496940902 Gurih\n",
"0 55496940902 Kompor\n",
"... ... ...\n",
"1591 98956365905 Sehat\n",
"1591 98956365905 Nasi\n",
"1591 98956365905 Masakan Utama\n",
"1591 98956365905 Bebas Susu\n",
"1591 98956365905 Masakan Internasional\n",
"\n",
"[21041 rows x 2 columns]"
],
"text/html": [
"\n",
" <div id=\"df-7b06261e-3a0d-4982-8e1b-d205b3888c84\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>tags</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Tidak Pedas</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Low</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Goreng</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Gurih</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kompor</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Sehat</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Nasi</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Masakan Utama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Bebas Susu</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Masakan Internasional</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21041 rows × 2 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7b06261e-3a0d-4982-8e1b-d205b3888c84')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-7b06261e-3a0d-4982-8e1b-d205b3888c84 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-7b06261e-3a0d-4982-8e1b-d205b3888c84');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 144
}
]
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_ingredients, 'mahi_c4', 'ingredients-c4')\n",
"export_dataframe(df_recipes, 'mahi_c4', 'recipes-c4')\n",
"export_dataframe(df_tags, 'mahi_c4', 'tags-c4')\n",
"\n",
"create_zip_file('mahi_c4')"
],
"metadata": {
"id": "yKlGPpC9jiNX",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "148add66-4c61-4b5e-fcf5-82120787282d"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_c4.zip created successfully!\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"# df_recipes = pd.read_csv('/content/drive/MyDrive/EzCook/2023/recipes-c1.csv', sep=',')\n",
"df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/June 2023/ingredients-c4.csv', sep=',')\n",
"df_recipes = pd.read_csv('/content/drive/MyDrive/EzCook/June 2023/recipes-c4.csv', sep=',')"
],
"metadata": {
"id": "etaM3WRFmKCT"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients['name'] = df_ingredients['name'].str.strip()\n",
"df_recipes['title'] = df_recipes['title'].str.strip()"
],
"metadata": {
"id": "WVP6lAflmrSb"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_recipes.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 634
},
"id": "6wLMMVxQmw_x",
"outputId": "b4c08f2c-b64f-4c39-f1aa-0c81365dd25a"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Rendang Ayam \n",
"2 44391341104 Nastar Lembut Anti Gagal \n",
"3 22338165911 Putri Salju Kacang Mede \n",
"4 33862184532 Es Cincau Gula Aren Segar dan Kaya Serat \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"\n",
" image_url servings time \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 4 90 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 6 120 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 8 120 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 8 90 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 4 30 \n",
"\n",
" calories difficulty instructions \\\n",
"0 0 Cukup Rumit ['Potong kentang memanjang seperti ukuran kent... \n",
"1 557 Cukup Rumit ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 0 Cukup Rumit ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 0 Cukup Rumit ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 0 Mudah ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"\n",
" slug \n",
"0 kentang-goreng-renyah-tahan-lama \n",
"1 rendang-ayam \n",
"2 nastar-lembut-anti-gagal \n",
"3 putri-salju-kacang-mede \n",
"4 es-cincau-gula-aren-segar-dan-kaya-serat "
],
"text/html": [
"\n",
" <div id=\"df-8b789fc5-4e7d-47ce-b0cd-b4ae541ce6e4\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>source_url</th>\n",
" <th>image_url</th>\n",
" <th>servings</th>\n",
" <th>time</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>slug</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>4</td>\n",
" <td>90</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>kentang-goreng-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>6</td>\n",
" <td>120</td>\n",
" <td>557</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>rendang-ayam</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>8</td>\n",
" <td>120</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>nastar-lembut-anti-gagal</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>8</td>\n",
" <td>90</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>putri-salju-kacang-mede</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>4</td>\n",
" <td>30</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>es-cincau-gula-aren-segar-dan-kaya-serat</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8b789fc5-4e7d-47ce-b0cd-b4ae541ce6e4')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-8b789fc5-4e7d-47ce-b0cd-b4ae541ce6e4 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-8b789fc5-4e7d-47ce-b0cd-b4ae541ce6e4');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 157
}
]
},
{
"cell_type": "code",
"source": [
"export_dataframe(df_ingredients, 'mahi_c5', 'ingredients-c5')\n",
"export_dataframe(df_recipes, 'mahi_c5', 'recipes-c5')\n",
"# export_dataframe(df_tags, 'mahi_c4', 'tags-c4')\n",
"\n",
"create_zip_file('mahi_c5')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Y2XcApy1mK7y",
"outputId": "7c76de31-ba88-4e34-d7a8-26e28e1fdb1a"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"mahi_c5.zip created successfully!\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Batch"
],
"metadata": {
"id": "M29y-rMbjixV"
}
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"df_ingredients = pd.read_csv('/content/drive/MyDrive/EzCook/ingredients-c5.csv', sep=',')"
],
"metadata": {
"id": "DspOBzcX3nJi"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df_ingredients"
],
"metadata": {
"id": "8D5X8K_J3p4r",
"outputId": "3809ad24-591c-41c2-e35b-5fc1b29d314a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
}
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id name recipe_id amount unit_id \\\n",
"0 1 Daun pisang 19667128120 NaN NaN \n",
"1 2 Minyak 19667128120 NaN NaN \n",
"2 3 Tepung ketan 19667128120 NaN NaN \n",
"3 4 tepung ketan 19667128120 300.0 9.0 \n",
"4 5 Buavita Guava 19667128120 200.0 13.0 \n",
"... ... ... ... ... ... \n",
"21035 21036 garam 69526158105 0.5 20.0 \n",
"21036 21037 minyak sayur 69526158105 1.0 19.0 \n",
"21037 21038 daun bawang 69526158105 1.0 1.0 \n",
"21038 21039 seledri 69526158105 1.0 1.0 \n",
"21039 21040 bawang merah goreng 69526158105 NaN NaN \n",
"\n",
" state \n",
"0 gunting mengikuti ukuran cetakan kue ku \n",
"1 untuk olesan \n",
"2 untuk taburan \n",
"3 NaN \n",
"4 NaN \n",
"... ... \n",
"21035 NaN \n",
"21036 NaN \n",
"21037 iris tipis \n",
"21038 iris tipis \n",
"21039 NaN \n",
"\n",
"[21040 rows x 6 columns]"
],
"text/html": [
"\n",
" <div id=\"df-6d1d3b66-8e81-45f7-943b-ef21bf170667\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>recipe_id</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>Daun pisang</td>\n",
" <td>19667128120</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>gunting mengikuti ukuran cetakan kue ku</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Minyak</td>\n",
" <td>19667128120</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk olesan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>Tepung ketan</td>\n",
" <td>19667128120</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>untuk taburan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>tepung ketan</td>\n",
" <td>19667128120</td>\n",
" <td>300.0</td>\n",
" <td>9.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Buavita Guava</td>\n",
" <td>19667128120</td>\n",
" <td>200.0</td>\n",
" <td>13.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21035</th>\n",
" <td>21036</td>\n",
" <td>garam</td>\n",
" <td>69526158105</td>\n",
" <td>0.5</td>\n",
" <td>20.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21036</th>\n",
" <td>21037</td>\n",
" <td>minyak sayur</td>\n",
" <td>69526158105</td>\n",
" <td>1.0</td>\n",
" <td>19.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21037</th>\n",
" <td>21038</td>\n",
" <td>daun bawang</td>\n",
" <td>69526158105</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21038</th>\n",
" <td>21039</td>\n",
" <td>seledri</td>\n",
" <td>69526158105</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>iris tipis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21039</th>\n",
" <td>21040</td>\n",
" <td>bawang merah goreng</td>\n",
" <td>69526158105</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21040 rows × 6 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-6d1d3b66-8e81-45f7-943b-ef21bf170667')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-6d1d3b66-8e81-45f7-943b-ef21bf170667 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-6d1d3b66-8e81-45f7-943b-ef21bf170667');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 188
}
]
},
{
"cell_type": "code",
"source": [
"!mkdir ingredients\n",
"\n",
"df_ingredients[0:3000].to_csv('ingredients/ingredients-c6-1' + '.csv', index=False, header=False)\n",
"df_ingredients[3000:6000].to_csv('ingredients/ingredients-c6-2' + '.csv', index=False, header=False)\n",
"df_ingredients[6000:9000].to_csv('ingredients/ingredients-c6-3' + '.csv', index=False, header=False)\n",
"df_ingredients[9000:12000].to_csv('ingredients/ingredients-c6-4' + '.csv', index=False, header=False)\n",
"df_ingredients[12000:15000].to_csv('ingredients/ingredients-c6-5' + '.csv', index=False, header=False)\n",
"df_ingredients[15000:18000].to_csv('ingredients/ingredients-c6-6' + '.csv', index=False, header=False)\n",
"df_ingredients[18000:21000].to_csv('ingredients/ingredients-c6-7' + '.csv', index=False, header=False)\n",
"df_ingredients[21000:].to_csv('ingredients/ingredients-c6-8' + '.csv', index=False, header=False)"
],
"metadata": {
"id": "rN4bdoi4Tbbf"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!zip -r ingredients1.zip ingredients/"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "xxwBPsrOZXTM",
"outputId": "654aba27-f4ef-44db-8738-3ec703d86263"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
" adding: ingredients/ (stored 0%)\n",
" adding: ingredients/ingredients-c6-5.csv (deflated 78%)\n",
" adding: ingredients/ingredients-c6-3.csv (deflated 77%)\n",
" adding: ingredients/ingredients-c6-2.csv (deflated 77%)\n",
" adding: ingredients/ingredients-c6-6.csv (deflated 78%)\n",
" adding: ingredients/ingredients-c6-7.csv (deflated 78%)\n",
" adding: ingredients/ingredients-c6-1.csv (deflated 77%)\n",
" adding: ingredients/ingredients-c6-4.csv (deflated 78%)\n",
" adding: ingredients/ingredients-c6-8.csv (deflated 65%)\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Read file\n",
"import pandas as pd\n",
"\n",
"df = pd.read_csv('tags-c4.csv', sep=',')\n",
"df"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
},
"id": "9z_wCz8oUl4K",
"outputId": "1fdaf432-4adb-4026-c6b8-45a8d285f373"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id tags\n",
"0 55496940902 Tidak Pedas\n",
"1 55496940902 Low\n",
"2 55496940902 Goreng\n",
"3 55496940902 Gurih\n",
"4 55496940902 Kompor\n",
"... ... ...\n",
"21036 98956365905 Sehat\n",
"21037 98956365905 Nasi\n",
"21038 98956365905 Masakan Utama\n",
"21039 98956365905 Bebas Susu\n",
"21040 98956365905 Masakan Internasional\n",
"\n",
"[21041 rows x 2 columns]"
],
"text/html": [
"\n",
" <div id=\"df-ca866449-659f-4d01-a275-e2d2a8a9ed8a\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>tags</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Tidak Pedas</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>55496940902</td>\n",
" <td>Low</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55496940902</td>\n",
" <td>Goreng</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>55496940902</td>\n",
" <td>Gurih</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>55496940902</td>\n",
" <td>Kompor</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21036</th>\n",
" <td>98956365905</td>\n",
" <td>Sehat</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21037</th>\n",
" <td>98956365905</td>\n",
" <td>Nasi</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21038</th>\n",
" <td>98956365905</td>\n",
" <td>Masakan Utama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21039</th>\n",
" <td>98956365905</td>\n",
" <td>Bebas Susu</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21040</th>\n",
" <td>98956365905</td>\n",
" <td>Masakan Internasional</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21041 rows × 2 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-ca866449-659f-4d01-a275-e2d2a8a9ed8a')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-ca866449-659f-4d01-a275-e2d2a8a9ed8a button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-ca866449-659f-4d01-a275-e2d2a8a9ed8a');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 25
}
]
},
{
"cell_type": "code",
"source": [
"df[\"recipe_id\"] = df[\"id\"]\n",
"df[\"id\"] = df.index + 1"
],
"metadata": {
"id": "8k1LCDk-bAm5"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
},
"id": "Z0l_y_TMbDZk",
"outputId": "7188e525-61d9-44d3-ccab-fe02d432fb80"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id tags recipe_id\n",
"0 1 Tidak Pedas 55496940902\n",
"1 2 Low 55496940902\n",
"2 3 Goreng 55496940902\n",
"3 4 Gurih 55496940902\n",
"4 5 Kompor 55496940902\n",
"... ... ... ...\n",
"21036 21037 Sehat 98956365905\n",
"21037 21038 Nasi 98956365905\n",
"21038 21039 Masakan Utama 98956365905\n",
"21039 21040 Bebas Susu 98956365905\n",
"21040 21041 Masakan Internasional 98956365905\n",
"\n",
"[21041 rows x 3 columns]"
],
"text/html": [
"\n",
" <div id=\"df-dc8093d7-500c-491d-b917-bb2220a70128\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>tags</th>\n",
" <th>recipe_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>Tidak Pedas</td>\n",
" <td>55496940902</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Low</td>\n",
" <td>55496940902</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>Goreng</td>\n",
" <td>55496940902</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>Gurih</td>\n",
" <td>55496940902</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Kompor</td>\n",
" <td>55496940902</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21036</th>\n",
" <td>21037</td>\n",
" <td>Sehat</td>\n",
" <td>98956365905</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21037</th>\n",
" <td>21038</td>\n",
" <td>Nasi</td>\n",
" <td>98956365905</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21038</th>\n",
" <td>21039</td>\n",
" <td>Masakan Utama</td>\n",
" <td>98956365905</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21039</th>\n",
" <td>21040</td>\n",
" <td>Bebas Susu</td>\n",
" <td>98956365905</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21040</th>\n",
" <td>21041</td>\n",
" <td>Masakan Internasional</td>\n",
" <td>98956365905</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21041 rows × 3 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-dc8093d7-500c-491d-b917-bb2220a70128')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-dc8093d7-500c-491d-b917-bb2220a70128 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-dc8093d7-500c-491d-b917-bb2220a70128');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 27
}
]
},
{
"cell_type": "code",
"source": [
"df = df[[\"id\", \"tags\", \"recipe_id\"]].rename({\"tags\": \"tag\"})\n",
"df.to_csv(\"tags-c4-tersusun.csv\", index=False, header=False)"
],
"metadata": {
"id": "P9-LEC_NU2MB"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"df"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 798
},
"id": "adm9lzyQXYT_",
"outputId": "0be58a2e-d480-497c-e6ab-a01539a01b78"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id title \\\n",
"0 55496940902 Kentang Goreng Renyah Tahan Lama \n",
"1 16996267501 Rendang Ayam \n",
"2 44391341104 Nastar Lembut Anti Gagal \n",
"3 22338165911 Putri Salju Kacang Mede \n",
"4 33862184532 Es Cincau Gula Aren Segar dan Kaya Serat \n",
"... ... ... \n",
"1587 25620239892 Oseng-oseng Buncis \n",
"1588 56963177846 Bakwan Sayur Renyah Tahan Lama \n",
"1589 26253073220 Ayam Bakar Bumbu Rujak \n",
"1590 85439463789 Martabak Mie Telur Kornet \n",
"1591 98956365905 Bubur Ayam Hainan Menyehatkan \n",
"\n",
" image_url time servings \\\n",
"0 https://www.masakapahariini.com/wp-content/upl... 90 4 \n",
"1 https://www.masakapahariini.com/wp-content/upl... 120 6 \n",
"2 https://www.masakapahariini.com/wp-content/upl... 120 8 \n",
"3 https://www.masakapahariini.com/wp-content/upl... 90 8 \n",
"4 https://www.masakapahariini.com/wp-content/upl... 30 4 \n",
"... ... ... ... \n",
"1587 https://www.masakapahariini.com/wp-content/upl... 25 2 \n",
"1588 https://www.masakapahariini.com/wp-content/upl... 45 4 \n",
"1589 https://www.masakapahariini.com/wp-content/upl... 75 4 \n",
"1590 https://www.masakapahariini.com/wp-content/upl... 25 4 \n",
"1591 https://www.masakapahariini.com/wp-content/upl... 45 4 \n",
"\n",
" calories difficulty \\\n",
"0 0 Cukup Rumit \n",
"1 557 Cukup Rumit \n",
"2 0 Cukup Rumit \n",
"3 0 Cukup Rumit \n",
"4 0 Mudah \n",
"... ... ... \n",
"1587 334 Mudah \n",
"1588 0 Mudah \n",
"1589 0 Mudah \n",
"1590 139 Mudah \n",
"1591 212 Mudah \n",
"\n",
" instructions \\\n",
"0 ['Potong kentang memanjang seperti ukuran kent... \n",
"1 ['Tumis bumbu halus hingga harum. Tambahkan ai... \n",
"2 ['Selai nanas: Masak nanas parut, kayu manis, ... \n",
"3 ['Panaskan oven pada suhu 150° C.', 'Kocok men... \n",
"4 ['Seduh SariWangi Teh Asli bersama air panas d... \n",
"... ... \n",
"1587 ['Panaskan wajan dan minyak. Tumis bawang puti... \n",
"1588 ['Di dalam wadah: aduk tepung terigu, Royco Ka... \n",
"1589 ['Bumbui ayam dengan sedikit garam, lalu pangg... \n",
"1590 ['Campurkan Royco Kaldu Sapi, telur, mie, korn... \n",
"1591 ['Panaskan minyak, tumis bawang putih dan jahe... \n",
"\n",
" source_url \\\n",
"0 https://www.masakapahariini.com/resep/cara-mem... \n",
"1 https://www.masakapahariini.com/resep/resep-ay... \n",
"2 https://www.masakapahariini.com/resep/resep-na... \n",
"3 https://www.masakapahariini.com/resep/resep-pu... \n",
"4 https://www.masakapahariini.com/resep/resep-es... \n",
"... ... \n",
"1587 https://www.masakapahariini.com/resep/resep-os... \n",
"1588 https://www.masakapahariini.com/resep/resep-ba... \n",
"1589 https://www.masakapahariini.com/resep/resep-ay... \n",
"1590 https://www.masakapahariini.com/resep/resep-ma... \n",
"1591 https://www.masakapahariini.com/resep/resep-bu... \n",
"\n",
" slug \n",
"0 kentang-goreng-renyah-tahan-lama \n",
"1 rendang-ayam \n",
"2 nastar-lembut-anti-gagal \n",
"3 putri-salju-kacang-mede \n",
"4 es-cincau-gula-aren-segar-dan-kaya-serat \n",
"... ... \n",
"1587 oseng-oseng-buncis \n",
"1588 bakwan-sayur-renyah-tahan-lama \n",
"1589 ayam-bakar-bumbu-rujak \n",
"1590 martabak-mie-telur-kornet \n",
"1591 bubur-ayam-hainan-menyehatkan \n",
"\n",
"[1591 rows x 10 columns]"
],
"text/html": [
"\n",
" <div id=\"df-5c6e0e51-6ff7-4f74-bcec-e1f2c1d5ed97\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>title</th>\n",
" <th>image_url</th>\n",
" <th>time</th>\n",
" <th>servings</th>\n",
" <th>calories</th>\n",
" <th>difficulty</th>\n",
" <th>instructions</th>\n",
" <th>source_url</th>\n",
" <th>slug</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>55496940902</td>\n",
" <td>Kentang Goreng Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>90</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Potong kentang memanjang seperti ukuran kent...</td>\n",
" <td>https://www.masakapahariini.com/resep/cara-mem...</td>\n",
" <td>kentang-goreng-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>16996267501</td>\n",
" <td>Rendang Ayam</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>120</td>\n",
" <td>6</td>\n",
" <td>557</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Tumis bumbu halus hingga harum. Tambahkan ai...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>rendang-ayam</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>44391341104</td>\n",
" <td>Nastar Lembut Anti Gagal</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>120</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Selai nanas: Masak nanas parut, kayu manis, ...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-na...</td>\n",
" <td>nastar-lembut-anti-gagal</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>22338165911</td>\n",
" <td>Putri Salju Kacang Mede</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>90</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>Cukup Rumit</td>\n",
" <td>['Panaskan oven pada suhu 150° C.', 'Kocok men...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-pu...</td>\n",
" <td>putri-salju-kacang-mede</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33862184532</td>\n",
" <td>Es Cincau Gula Aren Segar dan Kaya Serat</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>30</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Seduh SariWangi Teh Asli bersama air panas d...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-es...</td>\n",
" <td>es-cincau-gula-aren-segar-dan-kaya-serat</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1587</th>\n",
" <td>25620239892</td>\n",
" <td>Oseng-oseng Buncis</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>25</td>\n",
" <td>2</td>\n",
" <td>334</td>\n",
" <td>Mudah</td>\n",
" <td>['Panaskan wajan dan minyak. Tumis bawang puti...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-os...</td>\n",
" <td>oseng-oseng-buncis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1588</th>\n",
" <td>56963177846</td>\n",
" <td>Bakwan Sayur Renyah Tahan Lama</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>45</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Di dalam wadah: aduk tepung terigu, Royco Ka...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ba...</td>\n",
" <td>bakwan-sayur-renyah-tahan-lama</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1589</th>\n",
" <td>26253073220</td>\n",
" <td>Ayam Bakar Bumbu Rujak</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>75</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Mudah</td>\n",
" <td>['Bumbui ayam dengan sedikit garam, lalu pangg...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ay...</td>\n",
" <td>ayam-bakar-bumbu-rujak</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1590</th>\n",
" <td>85439463789</td>\n",
" <td>Martabak Mie Telur Kornet</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>25</td>\n",
" <td>4</td>\n",
" <td>139</td>\n",
" <td>Mudah</td>\n",
" <td>['Campurkan Royco Kaldu Sapi, telur, mie, korn...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-ma...</td>\n",
" <td>martabak-mie-telur-kornet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1591</th>\n",
" <td>98956365905</td>\n",
" <td>Bubur Ayam Hainan Menyehatkan</td>\n",
" <td>https://www.masakapahariini.com/wp-content/upl...</td>\n",
" <td>45</td>\n",
" <td>4</td>\n",
" <td>212</td>\n",
" <td>Mudah</td>\n",
" <td>['Panaskan minyak, tumis bawang putih dan jahe...</td>\n",
" <td>https://www.masakapahariini.com/resep/resep-bu...</td>\n",
" <td>bubur-ayam-hainan-menyehatkan</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1591 rows × 10 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5c6e0e51-6ff7-4f74-bcec-e1f2c1d5ed97')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-5c6e0e51-6ff7-4f74-bcec-e1f2c1d5ed97 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-5c6e0e51-6ff7-4f74-bcec-e1f2c1d5ed97');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 14
}
]
},
{
"cell_type": "code",
"source": [
"df[df.duplicated(subset='id', keep=False)]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "I4-582HfWONI",
"outputId": "fe1d8ef1-8e36-46f7-a5a0-35ad9afee78c"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id name recipe_id amount unit_id \\\n",
"152 153 Hellmann's Real Mayonnaise 11817808076 0 NaN \n",
"153 153 Hellmann's Real Mayonnaise 11817808076 0 NaN \n",
"198 198 Hellmann's Real Mayonnaise 91398292597 3 26.0 \n",
"199 198 Hellmann's Real Mayonnaise 91398292597 3 26.0 \n",
"1086 1085 Hellmann's Real Mayonnaise 45168210867 4 26.0 \n",
"1087 1085 Hellmann's Real Mayonnaise 45168210867 4 26.0 \n",
"1172 1170 Hellmann's Real Mayonnaise 86212210256 5 26.0 \n",
"1173 1170 Hellmann's Real Mayonnaise 86212210256 5 26.0 \n",
"1838 1835 Hellmann's Real Mayonnaise 55385763087 5 26.0 \n",
"1839 1835 Hellmann's Real Mayonnaise 55385763087 5 26.0 \n",
"2214 2210 Hellmann's Real Mayonnaise 75802958080 150 10.0 \n",
"2215 2210 Hellmann's Real Mayonnaise 75802958080 150 10.0 \n",
"2980 2975 Hellmann's Real Mayonnaise 77774305212 4 26.0 \n",
"2981 2975 Hellmann's Real Mayonnaise 77774305212 4 26.0 \n",
"3162 3156 Hellmann's Real Mayonnaise 30787072082 10 26.0 \n",
"3163 3156 Hellmann's Real Mayonnaise 30787072082 10 26.0 \n",
"3670 3663 Hellmann's Real Mayonnaise 17939171727 6 26.0 \n",
"3671 3663 Hellmann's Real Mayonnaise 17939171727 6 26.0 \n",
"6074 6066 Hellmann's Real Mayonnaise 14326277867 8 26.0 \n",
"6075 6066 Hellmann's Real Mayonnaise 14326277867 8 26.0 \n",
"6480 6471 Hellmann's Real Mayonnaise 99356543707 100 10.0 \n",
"6481 6471 Hellmann's Real Mayonnaise 99356543707 100 10.0 \n",
"7119 7109 Hellmann's Real Mayonnaise 74146229513 0 NaN \n",
"7120 7109 Hellmann's Real Mayonnaise 74146229513 0 NaN \n",
"7585 7574 Hellmann's Real Mayonnaise 97812594148 4 26.0 \n",
"7586 7574 Hellmann's Real Mayonnaise 97812594148 4 26.0 \n",
"8178 8166 Hellmann's Real Mayonnaise 17513523975 0 NaN \n",
"8179 8166 Hellmann's Real Mayonnaise 17513523975 0 NaN \n",
"8235 8222 Hellmann's Real Mayonnaise 40285267713 250 16.0 \n",
"8236 8222 Hellmann's Real Mayonnaise 40285267713 250 16.0 \n",
"9558 9544 Hellmann's Real Mayonnaise 41948787362 200 10.0 \n",
"9559 9544 Hellmann's Real Mayonnaise 41948787362 200 10.0 \n",
"9676 9661 Hellmann's Real Mayonnaise 42335288819 5 26.0 \n",
"9677 9661 Hellmann's Real Mayonnaise 42335288819 5 26.0 \n",
"9749 9733 Hellmann's Real Mayonnaise 45317624667 0 NaN \n",
"9750 9733 Hellmann's Real Mayonnaise 45317624667 0 NaN \n",
"10190 10173 Hellmann's Real Mayonnaise 95640120710 100 10.0 \n",
"10191 10173 Hellmann's Real Mayonnaise 95640120710 100 10.0 \n",
"10368 10350 apel Malang atau apel Manalagi 68797556408 300 10.0 \n",
"10369 10350 apel Malang atau apel Manalagi 68797556408 300 10.0 \n",
"10427 10408 Hellmann's Real Mayonnaise 88680760468 150 10.0 \n",
"10428 10408 Hellmann's Real Mayonnaise 88680760468 150 10.0 \n",
"10472 10452 Hellmann's Real Mayonnaise 82379358987 2 26.0 \n",
"10473 10452 Hellmann's Real Mayonnaise 82379358987 2 26.0 \n",
"12247 12226 Hellmann's Real Mayonnaise 61286500969 4 26.0 \n",
"12248 12226 Hellmann's Real Mayonnaise 61286500969 4 26.0 \n",
"12469 12447 Hellmann's Real Mayonnaise 44336052869 5 26.0 \n",
"12470 12447 Hellmann's Real Mayonnaise 44336052869 5 26.0 \n",
"12886 12863 Hellmann's Real Mayonnaise 65628628510 2 26.0 \n",
"12887 12863 Hellmann's Real Mayonnaise 65628628510 2 26.0 \n",
"14620 14596 Hellmann's Real Mayonnaise 81964244958 3 26.0 \n",
"14621 14596 Hellmann's Real Mayonnaise 81964244958 3 26.0 \n",
"15567 15542 kulit dan tulang ayam 43849533012 400 10.0 \n",
"15568 15542 kulit dan tulang ayam 43849533012 400 10.0 \n",
"\n",
" state raw_ingredient_id \n",
"152 NaN 313.0 \n",
"153 NaN 313.0 \n",
"198 NaN 313.0 \n",
"199 NaN 313.0 \n",
"1086 NaN 313.0 \n",
"1087 NaN 313.0 \n",
"1172 NaN 313.0 \n",
"1173 NaN 313.0 \n",
"1838 NaN 313.0 \n",
"1839 NaN 313.0 \n",
"2214 NaN 313.0 \n",
"2215 NaN 313.0 \n",
"2980 NaN 313.0 \n",
"2981 NaN 313.0 \n",
"3162 NaN 313.0 \n",
"3163 NaN 313.0 \n",
"3670 NaN 313.0 \n",
"3671 NaN 313.0 \n",
"6074 NaN 313.0 \n",
"6075 NaN 313.0 \n",
"6480 NaN 313.0 \n",
"6481 NaN 313.0 \n",
"7119 NaN 313.0 \n",
"7120 NaN 313.0 \n",
"7585 NaN 313.0 \n",
"7586 NaN 313.0 \n",
"8178 NaN 313.0 \n",
"8179 NaN 313.0 \n",
"8235 NaN 313.0 \n",
"8236 NaN 313.0 \n",
"9558 NaN 313.0 \n",
"9559 NaN 313.0 \n",
"9676 NaN 313.0 \n",
"9677 NaN 313.0 \n",
"9749 NaN 313.0 \n",
"9750 NaN 313.0 \n",
"10190 NaN 313.0 \n",
"10191 NaN 313.0 \n",
"10368 NaN 20.0 \n",
"10369 NaN 21.0 \n",
"10427 NaN 313.0 \n",
"10428 NaN 313.0 \n",
"10472 NaN 313.0 \n",
"10473 NaN 313.0 \n",
"12247 NaN 313.0 \n",
"12248 NaN 313.0 \n",
"12469 NaN 313.0 \n",
"12470 NaN 313.0 \n",
"12886 NaN 313.0 \n",
"12887 NaN 313.0 \n",
"14620 NaN 313.0 \n",
"14621 NaN 313.0 \n",
"15567 NaN 45.0 \n",
"15568 NaN 49.0 "
],
"text/html": [
"\n",
" <div id=\"df-666f6b66-9904-4ffc-aa06-e4bb3baaf4d6\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>recipe_id</th>\n",
" <th>amount</th>\n",
" <th>unit_id</th>\n",
" <th>state</th>\n",
" <th>raw_ingredient_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>152</th>\n",
" <td>153</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>11817808076</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>153</th>\n",
" <td>153</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>11817808076</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>198</th>\n",
" <td>198</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>91398292597</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>199</th>\n",
" <td>198</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>91398292597</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1086</th>\n",
" <td>1085</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>45168210867</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1087</th>\n",
" <td>1085</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>45168210867</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1172</th>\n",
" <td>1170</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>86212210256</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1173</th>\n",
" <td>1170</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>86212210256</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1838</th>\n",
" <td>1835</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>55385763087</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1839</th>\n",
" <td>1835</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>55385763087</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2214</th>\n",
" <td>2210</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>75802958080</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2215</th>\n",
" <td>2210</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>75802958080</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2980</th>\n",
" <td>2975</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>77774305212</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2981</th>\n",
" <td>2975</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>77774305212</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3162</th>\n",
" <td>3156</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>30787072082</td>\n",
" <td>10</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3163</th>\n",
" <td>3156</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>30787072082</td>\n",
" <td>10</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3670</th>\n",
" <td>3663</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>17939171727</td>\n",
" <td>6</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3671</th>\n",
" <td>3663</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>17939171727</td>\n",
" <td>6</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6074</th>\n",
" <td>6066</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>14326277867</td>\n",
" <td>8</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6075</th>\n",
" <td>6066</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>14326277867</td>\n",
" <td>8</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6480</th>\n",
" <td>6471</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>99356543707</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6481</th>\n",
" <td>6471</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>99356543707</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7119</th>\n",
" <td>7109</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>74146229513</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7120</th>\n",
" <td>7109</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>74146229513</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7585</th>\n",
" <td>7574</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>97812594148</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7586</th>\n",
" <td>7574</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>97812594148</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8178</th>\n",
" <td>8166</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>17513523975</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8179</th>\n",
" <td>8166</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>17513523975</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8235</th>\n",
" <td>8222</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>40285267713</td>\n",
" <td>250</td>\n",
" <td>16.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8236</th>\n",
" <td>8222</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>40285267713</td>\n",
" <td>250</td>\n",
" <td>16.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9558</th>\n",
" <td>9544</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>41948787362</td>\n",
" <td>200</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9559</th>\n",
" <td>9544</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>41948787362</td>\n",
" <td>200</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9676</th>\n",
" <td>9661</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>42335288819</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9677</th>\n",
" <td>9661</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>42335288819</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9749</th>\n",
" <td>9733</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>45317624667</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9750</th>\n",
" <td>9733</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>45317624667</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10190</th>\n",
" <td>10173</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>95640120710</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10191</th>\n",
" <td>10173</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>95640120710</td>\n",
" <td>100</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10368</th>\n",
" <td>10350</td>\n",
" <td>apel Malang atau apel Manalagi</td>\n",
" <td>68797556408</td>\n",
" <td>300</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>20.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10369</th>\n",
" <td>10350</td>\n",
" <td>apel Malang atau apel Manalagi</td>\n",
" <td>68797556408</td>\n",
" <td>300</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>21.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10427</th>\n",
" <td>10408</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>88680760468</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10428</th>\n",
" <td>10408</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>88680760468</td>\n",
" <td>150</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10472</th>\n",
" <td>10452</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>82379358987</td>\n",
" <td>2</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10473</th>\n",
" <td>10452</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>82379358987</td>\n",
" <td>2</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12247</th>\n",
" <td>12226</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>61286500969</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12248</th>\n",
" <td>12226</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>61286500969</td>\n",
" <td>4</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12469</th>\n",
" <td>12447</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>44336052869</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12470</th>\n",
" <td>12447</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>44336052869</td>\n",
" <td>5</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12886</th>\n",
" <td>12863</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>65628628510</td>\n",
" <td>2</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12887</th>\n",
" <td>12863</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>65628628510</td>\n",
" <td>2</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14620</th>\n",
" <td>14596</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>81964244958</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14621</th>\n",
" <td>14596</td>\n",
" <td>Hellmann's Real Mayonnaise</td>\n",
" <td>81964244958</td>\n",
" <td>3</td>\n",
" <td>26.0</td>\n",
" <td>NaN</td>\n",
" <td>313.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15567</th>\n",
" <td>15542</td>\n",
" <td>kulit dan tulang ayam</td>\n",
" <td>43849533012</td>\n",
" <td>400</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>45.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15568</th>\n",
" <td>15542</td>\n",
" <td>kulit dan tulang ayam</td>\n",
" <td>43849533012</td>\n",
" <td>400</td>\n",
" <td>10.0</td>\n",
" <td>NaN</td>\n",
" <td>49.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-666f6b66-9904-4ffc-aa06-e4bb3baaf4d6')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-666f6b66-9904-4ffc-aa06-e4bb3baaf4d6 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-666f6b66-9904-4ffc-aa06-e4bb3baaf4d6');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 18
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "lNYBYPkmZy3d"
},
"execution_count": null,
"outputs": []
}
]
}