From a0ee200ff89e1cef6034e93bfa63494649272b94 Mon Sep 17 00:00:00 2001 From: CHANGCHENWEI <44867705+CHANGCHENWEI@users.noreply.github.com> Date: Sat, 10 Nov 2018 09:52:20 +0800 Subject: [PATCH] Add files via upload --- ...345\274\265\345\256\270\347\221\213.ipynb" | 50 +++++++++++++++++++ ...345\274\265\345\256\270\347\221\213.ipynb" | 48 ++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 "110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \346\210\221\350\246\201\347\224\237\345\245\263\345\205\222 \345\274\265\345\256\270\347\221\213.ipynb" create mode 100644 "110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \347\266\262\350\267\257\347\210\254\350\237\262 \345\274\265\345\256\270\347\221\213.ipynb" diff --git "a/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \346\210\221\350\246\201\347\224\237\345\245\263\345\205\222 \345\274\265\345\256\270\347\221\213.ipynb" "b/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \346\210\221\350\246\201\347\224\237\345\245\263\345\205\222 \345\274\265\345\256\270\347\221\213.ipynb" new file mode 100644 index 0000000..1e134ef --- /dev/null +++ "b/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \346\210\221\350\246\201\347\224\237\345\245\263\345\205\222 \345\274\265\345\256\270\347\221\213.ipynb" @@ -0,0 +1,50 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "prob(girl.born) = 0.49\n", + "prob(boy.born) = 0.51\n", + "\n", + "import random\n", + "a = random.randrange(0, 100, 1) \n", + "\n", + "if a > 48 :\n", + " return child.count==1\n", + "elif a > 48 and child.count==1 :\n", + " return child.count+1\n", + "elif a > 48 and child.count==2 :\n", + " return child.count+1\n", + "elif child.count==3 :\n", + " print('end')\n", + "else a < 48 :\n", + " print('girl.born')\n", + " " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git "a/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \347\266\262\350\267\257\347\210\254\350\237\262 \345\274\265\345\256\270\347\221\213.ipynb" "b/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \347\266\262\350\267\257\347\210\254\350\237\262 \345\274\265\345\256\270\347\221\213.ipynb" new file mode 100644 index 0000000..82adf37 --- /dev/null +++ "b/110304 \350\252\262\345\240\202\344\275\234\346\245\255 - \347\266\262\350\267\257\347\210\254\350\237\262 \345\274\265\345\256\270\347\221\213.ipynb" @@ -0,0 +1,48 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import pandas as pd\n", + "from sqlalchemy import create_engine\n", + "\n", + "req = requests.get('http://tw.movies.yahoo.com/movieinfo_main.html/id=5644/AQI.json')\n", + "data = json.loads(req.content.decode('utf8'))\n", + "df = pd.DataFrame(data)\n", + "\n", + "engine = create_engine('sqlite:///:memory:')\n", + "df.to_sql('db_table', engine, index=False)\n", + "print(pd.read_sql_query('SELECT `Release Date` as `上映日期`, `Genres` as `類型`, \\\n", + "Run Time as `片長`, `Director` as `導演`, , `Actors` as `演員`, `Distribution Corporation` as `發行公司`, \\\n", + ", `Official Website` as `官方網站`, `Synopsis` as `劇情介紹`, FROM `db_table` \\\n", + "order by CAST(`MOVIE` AS int) DESC', engine))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}