{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import floatview\n",
    "import pandas as pd\n",
    "import requests\n",
    "import io"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "url=\"https://perso.telecom-paristech.fr/eagan/class/igr204/data/cars.csv\"\n",
    "s=requests.get(url).content\n",
    "tab = pd.read_csv(io.StringIO(s.decode('utf-8')), index_col=False, sep=';', skiprows=[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gmw = floatview.GlueManagerWidget(tab, modal=True, label=\"400Cars\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gmw.gluemanager.newView(\"scatter\", [\"Cylinders\", \"MPG\"], \"CylindersxMPG\");\n",
    "gmw.gluemanager.newView(\"parallels\", [\"Acceleration\", \"Cylinders\", \"MPG\",\"Cylinders\",\"Weight\"], \"Parallel\");\n",
    "gmw.gluemanager.newView(\"table\", [\"Acceleration\", \"Cylinders\", \"MPG\",\"Cylinders\",\"Weight\"], \"Table\");\n",
    "gmw.gluemanager.newView(\"histogram\", [\"Cylinders\"], \"Cylinders\");\n",
    "gmw.gluemanager.newView(\"contour\", [\"Weight\", \"MPG\"], \"CylindersxMPG\");\n",
    "gmw.gluemanager.newView(\"errorbar\", [\"Acceleration\", \"Cylinders\"], \"CylindersxMPG\");\n",
    "gmw.gluemanager.newView(\"composed_lines\", [\"Cylinders\", \"MPG\",\"Weight\"], \"CylindersxMPG\");\n",
    "gmw.gluemanager.newView(\"composed_polyfit_3d\", [\"MPG\",\"Weight\"], \"CylindersxMPG\");\n",
    "gmw.gluemanager.newView(\"scatter3D\", [\"MPG\",\"Horsepower\",\"Weight\"]);\n",
    "gmw.gluemanager.newView(\"image\", [\"MPG\",\"Horsepower\",\"Weight\"]);\n",
    "gmw.gluemanager.newView(\"sankey\", [\"Acceleration\", \"Cylinders\", \"Model\", \"MPG\"], \"Cylinders flow MPG\");\n",
    "gmw.gluemanager.newView(\"pca\", [\"Acceleration\", \"Cylinders\", \"Model\", \"MPG\"], \"Principal Component Analisis\");\n",
    "gmw.gluemanager.newView(\"scatter\", [\"Cylinders\", \"MPG\"], \"CylindersxMPG\");"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gmw.gluemanager.updateSelection([i+100 for i in range(100)])\n",
    "gmw.gluemanager.createSubsetFromSelection(label='new_set')"
   ]
  }
 ],
 "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.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
