diff --git a/Load Data(Task 1).ipynb b/Load Data(Task 1).ipynb new file mode 100644 index 0000000..4290ab0 --- /dev/null +++ b/Load Data(Task 1).ipynb @@ -0,0 +1,287 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## DATA VISUALIZATION" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Note\n", + "***\n", + "If you are starting the notebook from this task, you can run cells from all the previous tasks in the kernel by going to the top menu and Kernel > Restart and Run All\n", + "***" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 1: Loading the Data " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import plotly.offline as py\n", + "py.init_notebook_mode(connected=True)\n", + "import plotly.graph_objs as go\n", + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 2: Quick Visualizations with Custom Bar Charts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 3: Plot Life Expectancy vs GDP per Capita" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 4: Customize Interactive Bubble Charts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 5: Create Interactive Animations and Facet Plots " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 6: Represent Geographic Data as Animated Maps" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 7: Interactive Line Plots and Area Plots " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Load Data(Task 1).py b/Load Data(Task 1).py new file mode 100644 index 0000000..eca4c0c --- /dev/null +++ b/Load Data(Task 1).py @@ -0,0 +1,5 @@ +import plotly.offline as py +py.init_notebook_mode(connected=True) +import plotly.graph_objs as go +import pandas as pd +import numpy as np \ No newline at end of file diff --git a/Quick Visualizations(Task 2).ipynb b/Quick Visualizations(Task 2).ipynb new file mode 100644 index 0000000..daa9285 --- /dev/null +++ b/Quick Visualizations(Task 2).ipynb @@ -0,0 +1,2506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## DATA VISUALIZATION" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### NOTE\n", + "***\n", + "If you are starting the notebook from this task, you can run cells from all the previous tasks in the kernel by going to the top menu and Kernel > Restart and Run All\n", + "***" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 1: Loading the Data " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import plotly.offline as py\n", + "py.init_notebook_mode(connected=True)\n", + "import plotly.graph_objs as go\n", + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "linkText": "Export to plotly.com", + "plotlyServerURL": "https://plotly.com", + "showLink": false + }, + "data": [ + { + "colorscale": [ + [ + 0, + "#00083e" + ], + [ + 0.5, + "#ededee" + ], + [ + 1, + "#ffffff" + ] + ], + "hoverinfo": "none", + "opacity": 0.75, + "showscale": false, + "type": "heatmap", + "z": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] + ] + } + ], + "layout": { + "annotations": [ + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "country", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "continent", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "year", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "lifeExp", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "pop", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "gdpPercap", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "iso_alpha", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#ffffff" + }, + "showarrow": false, + "text": "iso_num", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 0, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1952", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "28.801", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "8425333", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "779.4453145", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 1, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1957", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "30.331999999999997", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "9240934", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "820.8530296", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 2, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1962", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "31.997", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "10267083", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "853.1007099999999", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 3, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1967", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "34.02", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "11537966", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "836.1971382", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 4, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1972", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "36.088", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "13079460", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "739.9811057999999", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 5, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1977", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "38.438", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "14880372", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "786.11336", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 6, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1982", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "39.854", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "12881816", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "978.0114388000001", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 7, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1987", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "40.821999999999996", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "13867957", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "852.3959447999999", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 8, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1992", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "41.674", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "16317921", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "649.3413952000001", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 9, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Afghanistan", + "x": -0.45, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "Asia", + "x": 0.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "1997", + "x": 1.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "41.763000000000005", + "x": 2.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "22227415", + "x": 3.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "635.341351", + "x": 4.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "AFG", + "x": 5.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + }, + { + "align": "left", + "font": { + "color": "#000000" + }, + "showarrow": false, + "text": "4", + "x": 6.55, + "xanchor": "left", + "xref": "x", + "y": 10, + "yref": "y" + } + ], + "height": 380, + "margin": { + "b": 0, + "l": 0, + "r": 0, + "t": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "dtick": 1, + "gridwidth": 2, + "showticklabels": false, + "tick0": -0.5, + "ticks": "", + "zeroline": false + }, + "yaxis": { + "autorange": "reversed", + "dtick": 1, + "gridwidth": 2, + "showticklabels": false, + "tick0": 0.5, + "ticks": "", + "zeroline": false + } + } + }, + "text/html": [ + "
\n", + " \n", + " \n", + "
\n", + " \n", + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from plotly.figure_factory import create_table\n", + "import plotly.express as px\n", + "\n", + "gapminder = px.data.gapminder()\n", + "\n", + "table = create_table(gapminder.head(10))\n", + "py.iplot(table)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "pandas.core.frame.DataFrame" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(gapminder)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 2: Quick Visualizations with Custom Bar Charts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 3: Plot Life Expectancy vs GDP per Capita" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 4: Customize Interactive Bubble Charts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 5: Create Interactive Animations and Facet Plots \n", + "***\n", + "Note: If you are starting the notebook from this task, you can run cells from all the previous tasks in the kernel by going to the top menu and Kernel > Restart and Run All\n", + "***" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 6: Represent Geographic Data as Animated Maps\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Task 7: Interactive Line Plots and Area Plots \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Quick Visualizations(task 2).py b/Quick Visualizations(task 2).py new file mode 100644 index 0000000..6e93f48 --- /dev/null +++ b/Quick Visualizations(task 2).py @@ -0,0 +1,22 @@ +# Task 1 : Loading Data + +import plotly.offline as py +py.init_notebook_mode(connected=True) +import plotly.graph_objs as go +import pandas as pd +import numpy as np + +''' +The code below has some errors. +You need to find them and correct them +Of Course, I will help you. +''' + + +from plotly.figure_factory +import plotly.express as px + +gapminder = px.data.gapminder() + +table = create_table(gapminder.head(10)) +py.iplot(table) \ No newline at end of file diff --git a/README.md b/README.md index 67a8307..add87e4 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,35 @@ -# learn-lang +# Data-Visualization -There are many language learning tools so why have I created another one? This question might be tormenting you but let me tell you what is the new in this tool. +This is a simple data science project through which one can learn to create quick and easy interactive data visualizations with the help of a high level data visualization library in python : Plotly. +About the Data: +[Data Source](https://www.gapminder.org/tools/#$state$time$value=2007;;&chart-type=bubbles) -### Old Conventional Process -While learning a new language, you come across various phrases of it which you don't know the translation. -To know its translation, you +### Features: + Python, + Pandas, + Plotly, + Putting Animation in Visualizations, + Making Interactive Plots, + Techniques to enhance Visualization, + Represent Geopgraphic data + + + +##### Tasks will be added frequently -1. select the text -2. copy it -3. open the browser -4. search for google translate -5. paste the text there, -and then it is finally that you know the exact translation. -This is a very tedious process. -### New Process Using Tool -This tool allows to cut short the boring process of 5 steps to just 1 step. -1. select the text +### In this project, you have following tasks to do: -That is it. -By just one step, you will be knowing the complete exact translation. +#### 1: Loading the Data +#### 2: Plotting quick Visualizations with Custom Bar Charts +#### 3: Plotting more data. +#### 4: Customize Interactive Bubble Charts +#### 5: Create Interactive Animations and Facet Plots +#### 6: Represent Geographic Data as Animated Maps +#### 7: Interactive Line Plots and Area Plots -Along with translation, you will also know proper pronunciation as this will also speak the text in the proper accent of the language. -### How to make it work - -For the script to run successfully, certain modules are required. - -To download those modules, you can either simply run the f1.py file from this repository which will automatically download all the prerequisite modules, - -or you can download the manually by typing following commands - - -`$ pip3 install googletrans` - -`$pip3 install google-speech` - -`$sudo apt-get install sox libsox-fmt-mp3` - -`$sudo aptitude install xclip` - - - -##### Currently this is for linux users only. -##### For windows, I will be uploading another version soon. +##### Some Visualizations Example From this Project have been provided above. diff --git a/Sample Visualizations/Screenshot from 2020-05-07 20-27-51.png b/Sample Visualizations/Screenshot from 2020-05-07 20-27-51.png new file mode 100644 index 0000000..1e43397 Binary files /dev/null and b/Sample Visualizations/Screenshot from 2020-05-07 20-27-51.png differ diff --git a/Sample Visualizations/Screenshot from 2020-05-07 20-31-18.png b/Sample Visualizations/Screenshot from 2020-05-07 20-31-18.png new file mode 100644 index 0000000..2556ac2 Binary files /dev/null and b/Sample Visualizations/Screenshot from 2020-05-07 20-31-18.png differ diff --git a/Tasks/Task_1.pdf b/Tasks/Task_1.pdf new file mode 100644 index 0000000..8657936 Binary files /dev/null and b/Tasks/Task_1.pdf differ diff --git a/Tasks/Task_2.pdf b/Tasks/Task_2.pdf new file mode 100644 index 0000000..a508e81 Binary files /dev/null and b/Tasks/Task_2.pdf differ diff --git a/Tasks/Task_3.pdf b/Tasks/Task_3.pdf new file mode 100644 index 0000000..e7baefc Binary files /dev/null and b/Tasks/Task_3.pdf differ diff --git a/f1.py b/f1.py deleted file mode 100644 index 2b36480..0000000 --- a/f1.py +++ /dev/null @@ -1,13 +0,0 @@ -import subprocess - -#adds googletrans module -subprocess.call('(pip3 install googletrans)', shell = True) - -#adds google-speech module -subprocess.call('(pip3 install google-speech)', shell = True) - -#installs sox library for google-speech -subprocess.call('(sudo apt-get install sox libsox-fmt-mp3)', shell = True) - -#installs xclip -subprocess.call('(sudo aptitude install xclip)', shell = True) diff --git a/tool.py b/tool.py deleted file mode 100644 index d8e06f6..0000000 --- a/tool.py +++ /dev/null @@ -1,55 +0,0 @@ -from googletrans import Translator -from google_speech import Speech -import subprocess -import time - -ts = Translator() - -LangCodes = {'afrikaans': 'af', 'albanian': 'sq', 'amharic': 'am', 'arabic': 'ar', 'armenian': 'hy', 'azerbaijani': 'az', 'basque': 'eu', 'belarusian': 'be', - 'bengali': 'bn', 'bosnian': 'bs', 'bulgarian': 'bg', 'catalan': 'ca', 'cebuano': 'ceb', 'chichewa': 'ny', 'chinese (simplified)': 'zh-cn', - 'chinese (traditional)': 'zh-tw', 'corsican': 'co', 'croatian': 'hr', 'czech': 'cs', 'danish': 'da', 'dutch': 'nl', 'english': 'en', 'esperanto': 'eo', - 'estonian': 'et', 'filipino': 'tl', 'finnish': 'fi', 'french': 'fr', 'frisian': 'fy', 'galician': 'gl', 'georgian': 'ka', 'german': 'de', 'greek': 'el', - 'gujarati': 'gu', 'haitian creole': 'ht', 'hausa': 'ha', 'hawaiian': 'haw', 'hebrew': 'iw', 'hindi': 'hi', 'hmong': 'hmn', 'hungarian': 'hu', 'icelandic': 'is', - 'igbo': 'ig', 'indonesian': 'id', 'irish': 'ga', 'italian': 'it', 'japanese': 'ja', 'javanese': 'jw', 'kannada': 'kn', 'kazakh': 'kk', 'khmer': 'km', - 'korean': 'ko', 'kurdish (kurmanji)': 'ku', 'kyrgyz': 'ky', 'lao': 'lo', 'latin': 'la', 'latvian': 'lv', 'lithuanian': 'lt', 'luxembourgish': 'lb', - 'macedonian': 'mk', 'malagasy': 'mg', 'malay': 'ms', 'malayalam': 'ml', 'maltese': 'mt', 'maori': 'mi', 'marathi': 'mr', 'mongolian': 'mn', - 'myanmar (burmese)': 'my', 'nepali': 'ne', 'norwegian': 'no', 'pashto': 'ps', 'persian': 'fa', 'polish': 'pl', 'portuguese': 'pt', 'punjabi': 'pa', - 'romanian': 'ro', 'russian': 'ru', 'samoan': 'sm', 'scots gaelic': 'gd', 'serbian': 'sr', 'sesotho': 'st', 'shona': 'sn', 'sindhi': 'sd', 'sinhala': 'si', - 'slovak': 'sk', 'slovenian': 'sl', 'somali': 'so', 'spanish': 'es', 'sundanese': 'su', 'swahili': 'sw', 'swedish': 'sv', 'tajik': 'tg', 'tamil': 'ta', - 'telugu': 'te', 'thai': 'th', 'turkish': 'tr', 'ukrainian': 'uk', 'urdu': 'ur', 'uzbek': 'uz', 'vietnamese': 'vi', 'welsh': 'cy', 'xhosa': 'xh', - 'yiddish': 'yi', 'yoruba': 'yo', 'zulu': 'zu', 'Filipino': 'fil', 'Hebrew': 'he'} - - -lang = input('Enter the language you want translation into: ') - -try: - dest = LangCodes[lang] -except: - dest = 'en' - -previnp='' - -while(True): - - subprocess.call('(xclip -o > test.txt)', shell=True) - - f = open('test.txt','r+') - inp = f.read() - - if inp == previnp: - continue - - src = ts.detect(inp) - - s = ts.translate(inp,dest=dest,src=src.lang) - print(s.text) - snd = Speech(s.text, 'en') - snd.play() - print() - previnp = inp - time.sleep(3) - f.truncate(0) - f.close() - - -