{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from datetime import datetime, date\n", "from perspective import PerspectiveWidget" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# schema\n", "df = pd.DataFrame([\n", " {\n", " 'int': 1,\n", " 'float': 1.5,\n", " 'string': '20150505',\n", " 'date': date.today(),\n", " 'datetime': datetime.now(),\n", " 'object': datetime.now(),\n", " },\n", " {\n", " 'int': 1,\n", " 'float': 1.5,\n", " 'string': '20150506',\n", " 'date': None,\n", " 'datetime': None,\n", " 'object': None,\n", " },\n", "])" ] }, { "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", " \n", " \n", "
intfloatstringdatedatetimeobject
011.5201505052020-10-282020-10-28 19:03:08.9738122020-10-28 19:03:08.973813
111.520150506NoneNaTNaT
\n", "
" ], "text/plain": [ " int float string date datetime \\\n", "0 1 1.5 20150505 2020-10-28 2020-10-28 19:03:08.973812 \n", "1 1 1.5 20150506 None NaT \n", "\n", " object \n", "0 2020-10-28 19:03:08.973813 \n", "1 NaT " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "aaa7a6dd11b94169afdd7d0481167202", "version_major": 2, "version_minor": 0 }, "text/plain": [ "PerspectiveWidget(columns=['index', 'int', 'float', 'string', 'date', 'datetime', 'object'])" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "psp = PerspectiveWidget(df)\n", "psp" ] }, { "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.7" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "aaa7a6dd11b94169afdd7d0481167202": { "model_module": "@finos/perspective-jupyterlab", "model_module_version": "~0.5", "model_name": "PerspectiveModel", "state": { "_model_module_version": "~0.5", "_view_module_version": "~0.5", "aggregates": null, "column_pivots": null, "columns": [ "index", "int", "float", "string", "date", "datetime", "object" ], "dark": null, "row_pivots": null, "sort": null } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }