Created
July 28, 2020 09:33
-
-
Save NehaAkashDeo/6bb33f6e10a76dcfaf8d4ab138c9381f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 42, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# nbi:hide_in \n", | |
| "\n", | |
| "import pytrends\n", | |
| "from ipywidgets import interact\n", | |
| "from pytrends.request import TrendReq\n", | |
| "pytrend = TrendReq()\n", | |
| "import pandas as pd " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 51, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "application/vnd.jupyter.widget-view+json": { | |
| "model_id": "71df9f616698486b831070bd61ba9116", | |
| "version_major": 2, | |
| "version_minor": 0 | |
| }, | |
| "text/plain": [ | |
| "interactive(children=(Text(value='Hi', description='kw1'), Text(value='Hello', description='kw2'), Output()), …" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "source": [ | |
| "#kw_list=[]\n", | |
| "\n", | |
| "def display(kw1,kw2):\n", | |
| "# kw_list.append(kw1)\n", | |
| "# kw_list.append(kw2)\n", | |
| " #print(kw_list)\n", | |
| " return kw1,kw2\n", | |
| "\n", | |
| "interact(display, kw1=\"Hi\",kw2=\"Hello\");" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 44, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# nbi:hide_in \n", | |
| "\n", | |
| "# pytrend.build_payload(kw_list=kw_list, timeframe='today 5-y', geo='IN')" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 45, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# nbi:hide_in \n", | |
| "\n", | |
| "# interest_over_time_df=pytrend.interest_over_time()\n", | |
| "# print(interest_over_time_df)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 47, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# nbi:hide_in \n", | |
| "\n", | |
| "# from matplotlib import pyplot as plt \n", | |
| "# import time\n", | |
| "# import datetime\n", | |
| "# from datetime import datetime, date, time\n", | |
| "\n", | |
| "# %matplotlib inline" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# nbi:hide_in \n", | |
| "\n", | |
| "# dx= interest_over_time_df.plot.line(figsize=(12,8), title=\"Interest over time\",colormap=\"Set1\", linewidth=3)\n", | |
| "# dx.set_xlabel(\"Date\", fontsize=22)\n", | |
| "# dx.set_ylabel(\"Interest Over Time\", fontsize=22)\n", | |
| "# dx.tick_params(axis='both', which='major', labelsize=22)\n", | |
| "# dx.set_title('Comparison Across Keywords',fontsize=30)\n", | |
| "# dx.legend(fontsize=15)\n", | |
| "\n", | |
| "# dx.text(2640,-2,'Machine Generated Insights', style='italic', bbox={'facecolor': 'grey', 'alpha': 0.5, 'pad': 3}, rotation=270)\n", | |
| "# plt.show()" | |
| ] | |
| } | |
| ], | |
| "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.6" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment