diff --git a/experiments/experiments.ipynb b/experiments/experiments.ipynb deleted file mode 100644 index 66d706e..0000000 --- a/experiments/experiments.ipynb +++ /dev/null @@ -1,376 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Source code experiment" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import warnings\n", - "warnings.filterwarnings('ignore')" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
AnimalsType
0TigerWild
1LionWild
2CowDomestic
3DogDomestic
\n", - "
" - ], - "text/plain": [ - " Animals Type\n", - "0 Tiger Wild\n", - "1 Lion Wild\n", - "2 Cow Domestic\n", - "3 Dog Domestic" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# csv file testing:\n", - "import pandas as pd\n", - "from pathlib import Path\n", - "def load_csv(filepath:str, delimiter:str):\n", - " filepath = Path(filepath)\n", - " return pd.read_csv(filepath, delimiter=delimiter)\n", - "\n", - "df1 = load_csv('sample.csv', ',')\n", - "df1" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
AnimalsType
0TigerWild
1LionWild
2CowDomestic
3DogDomestic
\n", - "
" - ], - "text/plain": [ - " Animals Type\n", - "0 Tiger Wild\n", - "1 Lion Wild\n", - "2 Cow Domestic\n", - "3 Dog Domestic" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# excel sheet testing:\n", - "import pandas as pd\n", - "from pathlib import Path\n", - "def load_excelsheet(filepath:str, sheet_name:str):\n", - " filepath = Path(filepath)\n", - " return pd.read_excel(filepath, sheet_name=sheet_name)\n", - "\n", - "df2 = load_excelsheet('sample.xlsx', 'sample_sheet')\n", - "df2" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
AnimalsType
0TigerWild
1LionWild
2CowDomestic
3DogDomestic
\n", - "
" - ], - "text/plain": [ - " Animals Type\n", - "0 Tiger Wild\n", - "1 Lion Wild\n", - "2 Cow Domestic\n", - "3 Dog Domestic" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# google sheet testing:\n", - "import pandas as pd\n", - "def load_gsheet(gsheet_id:str, sheet_name:str):\n", - " base_url = 'https://docs.google.com/spreadsheets/d'\n", - " sheet_csv = 'gviz/tq?tqx=out:csv&sheet='\n", - " url = f'{base_url}/{gsheet_id}/{sheet_csv}{sheet_name}'\n", - " return pd.read_csv(url)\n", - "\n", - "df3 = load_gsheet('17r9f4BL7sjmdLBnt92OdQP3CHK5bdT3hozg6DUJXGqU', 'sample_sheet')\n", - "df3" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
AnimalsType
0TigerWild
1LionWild
2CowDomestic
3DogDomestic
\n", - "
" - ], - "text/plain": [ - " Animals Type\n", - "0 Tiger Wild\n", - "1 Lion Wild\n", - "2 Cow Domestic\n", - "3 Dog Domestic" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# load mongodb data:\n", - "import pandas as pd\n", - "from pymongo.mongo_client import MongoClient\n", - "def load_mongodbdata(host:str, database:str, collection:str):\n", - " client = MongoClient(host)\n", - " db = client[database]\n", - " col = db[collection]\n", - " records = col.find()\n", - " data = list(records)\n", - " df = pd.DataFrame(data)\n", - " df.drop('_id', axis=1, inplace=True)\n", - " return df\n", - "\n", - "df5 = load_mongodbdata('localhost', 'sample_database', 'sample_collection')\n", - "df5" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "dbsc", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/experiments/sample.csv b/experiments/sample.csv deleted file mode 100644 index 249e9b2..0000000 --- a/experiments/sample.csv +++ /dev/null @@ -1,5 +0,0 @@ -Animals,Type -Tiger,Wild -Lion,Wild -Cow,Domestic -Dog,Domestic diff --git a/experiments/sample.xlsx b/experiments/sample.xlsx deleted file mode 100644 index c2774e4..0000000 Binary files a/experiments/sample.xlsx and /dev/null differ