Skip to content

Commit

Permalink
del temp_df
Browse files Browse the repository at this point in the history
  • Loading branch information
Winston committed Mar 23, 2020
1 parent 3e2f3b3 commit d304742
Showing 1 changed file with 44 additions and 47 deletions.
91 changes: 44 additions & 47 deletions taxi_dashboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1258,20 +1258,7 @@
"text/html": [
"\n",
"<link rel=\"stylesheet\" href=\"https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css\">\n",
"<style>div.bk-hbox {\n",
" display: flex;\n",
" justify-content: center;\n",
"}\n",
"\n",
"div.bk-hbox div.bk-plot {\n",
" padding: 8px;\n",
"}\n",
"\n",
"div.bk-hbox div.bk-data-table {\n",
" padding: 20px;\n",
"}\n",
"\n",
"div.hololayout {\n",
"<style>div.hololayout {\n",
" display: flex;\n",
" align-items: center;\n",
" margin: 0;\n",
Expand Down Expand Up @@ -1364,6 +1351,19 @@
" margin-left: 0.5em;\n",
" margin-right: 0.5em;\n",
"}\n",
"\n",
"div.bk-hbox {\n",
" display: flex;\n",
" justify-content: center;\n",
"}\n",
"\n",
"div.bk-hbox div.bk-plot {\n",
" padding: 8px;\n",
"}\n",
"\n",
"div.bk-hbox div.bk-data-table {\n",
" padding: 20px;\n",
"}\n",
"</style>\n",
"\n",
"\n",
Expand Down Expand Up @@ -2300,10 +2300,10 @@
{
"data": {
"text/plain": [
"'/home/jupyter-winston/turbo-telegram/data/nyc_taxi_*'"
"'/jupyterhub-homes/winston@blazingdb.com/turbo-telegram/data/nyc_taxi_*'"
]
},
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -2348,15 +2348,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1.46 s, sys: 394 ms, total: 1.85 s\n",
"Wall time: 981 ms\n"
"CPU times: user 1.48 s, sys: 378 ms, total: 1.86 s\n",
"Wall time: 2.57 s\n"
]
},
{
Expand Down Expand Up @@ -2490,7 +2490,7 @@
"1911985 25.5 0.5 0.5 1.2 0.0 0.3 "
]
},
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -2500,7 +2500,8 @@
"# create base table\n",
"col_types = ['int', 'date64', 'date64', 'int', 'float64', 'float64', 'float64', 'int', 'str', 'float64', \n",
" 'float64', 'int', 'float64', 'float64', 'float64', 'float64', 'float64', 'float64', 'float64']\n",
"bc.create_table('big_taxi', '/home/jupyter-winston/turbo-telegram/data/nyc_taxi*.csv', dtype=col_types, header=0)\n",
"bc.create_table('big_taxi', path, dtype=col_types, header=0)\n",
"\n",
"# what's it look like? \n",
"bc.sql('select * from big_taxi').tail(3)"
]
Expand All @@ -2514,7 +2515,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -2536,17 +2537,11 @@
" # return sorted tuple (works best w/ widgets)\n",
" return tuple(unique)\n",
"\n",
"# make temp dataframe from time query + passenger_count \n",
"temp_df = bc.sql(time_table.replace('SELECT', 'SELECT passenger_count,'))\n",
"\n",
"# tag day, month, year & passenger count values for widgets\n",
"dy_vals = unique_sorted_values(temp_df.days)\n",
"mo_vals = unique_sorted_values(temp_df.months)\n",
"yr_vals = unique_sorted_values(temp_df.years)\n",
"rider_vals = unique_sorted_values(temp_df.passenger_count)\n",
"\n",
"# forget temp df\n",
"del temp_df\n",
"dy_vals = unique_sorted_values(bc.sql('select dayofmonth(tpep_pickup_datetime) days from big_taxi').days)\n",
"mo_vals = unique_sorted_values(bc.sql('select month(tpep_pickup_datetime) months from big_taxi').months)\n",
"yr_vals = unique_sorted_values(bc.sql('select year(tpep_pickup_datetime) years from big_taxi').years)\n",
"rider_vals = unique_sorted_values(bc.sql('select passenger_count from big_taxi').passenger_count)\n",
"\n",
"# dropdown days\n",
"dropdown_day = widgets.SelectMultiple(value=dy_vals, options=dy_vals, description='Days of Month')\n",
Expand Down Expand Up @@ -2588,8 +2583,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"execution_count": 7,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# build outputs (each will have it's own tab)\n",
Expand All @@ -2609,7 +2606,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -2762,7 +2759,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -2842,7 +2839,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -2874,13 +2871,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9d6b70a7c8b3461ab1b63e488d7da8bf",
"model_id": "5c7aeef9d03f43c4bc446964f2263a5d",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -2894,7 +2891,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f260a8b095bc42fba9a5ae3d3e13e265",
"model_id": "fe6bdfce7d0144b5bbe45fc497b50db1",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -2912,13 +2909,13 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "be30379be50043cebb22061fbef0f1fa",
"model_id": "17830fd6ea3f4d38bc4a34a04ef35bdc",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -2937,9 +2934,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "RAPIDS Stable",
"language": "python",
"name": "python3"
"name": "rapids-stable"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -2951,9 +2948,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit d304742

Please sign in to comment.