<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# PureCSV demo\n",
    "\n",
    "*A (shapeless-based) type-safe and boilerplate-free CSV library for Scala*\n",
    "\n",
    "https://github.com/melrief/PureCSV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's load it from sonatype, as indicated on the [PureCSV](https://github.com/melrief/PureCSV) page.\n",
    "\n",
    "Ignore the (annoying) Ivy resolution output - everything goes just well."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "test_ignore": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ":: problems summary ::\n",
      ":::: WARNINGS\n",
      "\tUnable to reparse com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT from sonatype-snapshots, using Fri May 22 10:44:01 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT, using Fri May 22 10:44:01 CEST 2015 and Fri May 22 10:44:01 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT, using Fri May 22 01:49:14 CEST 2015 and Fri May 22 01:49:14 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT\n",
      "\n",
      "\tUnable to reparse com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT from sonatype-snapshots, using Fri May 22 03:13:14 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT, using Fri May 22 03:13:14 CEST 2015 and Fri May 22 03:13:14 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT, using Fri May 22 01:56:25 CEST 2015 and Fri May 22 01:56:25 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT\n",
      "\n",
      "\tUnable to reparse com.github.alexarchambault.jupyter#jupyter-api_2.11;0.2.0-SNAPSHOT from sonatype-snapshots, using Thu May 21 21:38:28 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault.jupyter#jupyter-api_2.11;0.2.0-SNAPSHOT\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "load.ivy(\"com.github.melrief\" %% \"purecsv\" % \"0.0.1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Examples from the PureCSV README"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[32mimport \u001b[36mpurecsv._\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import purecsv._"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Simple example, using *unsafe* (= exception prone) API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mEvent\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Event(ts: Long, msg: String)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mrecords\u001b[0m: \u001b[32mscala.List[cmd3.INSTANCE.$ref$cmd2.Event]\u001b[0m = \u001b[33mList\u001b[0m(\u001b[33mEvent\u001b[0m(\u001b[32m1\u001b[0mL, \u001b[32m\"foo\"\u001b[0m), \u001b[33mEvent\u001b[0m(\u001b[32m2\u001b[0mL, \u001b[32m\"bar\"\u001b[0m))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "val records = unsafe.CSVReader[Event].readCSVFromString(\"1,foo\\n2,bar\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres4\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"\"\"\n",
       "1,\"foo\"\n",
       "2,\"bar\"\n",
       "\"\"\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import unsafe._; records.toCSV() }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Now with the safe API, writing CSV..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mInterval\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "class Interval(val start: Long, val end: Long)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres6\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"10,20\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import safe._; new Interval(10,20).toCSV() }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres7\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"\"\"\n",
       "1|10\n",
       "11|20\n",
       "\"\"\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import safe._; Seq(new Interval(1,10),new Interval(11,20)).toCSV(\"|\") }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### ... and reading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mPerson\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Person(name: String, age: Int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres9\u001b[0m: \u001b[32mscala.List[scala.util.Try[cmd9.INSTANCE.$ref$cmd8.Person]]\u001b[0m = \u001b[33mList\u001b[0m(Success(Person(alice,1)))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "safe.CSVReader[Person].readCSVFromString(\"alice,1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres10\u001b[0m: \u001b[32mscala.List[scala.util.Try[cmd10.INSTANCE.$ref$cmd8.Person]]\u001b[0m = \u001b[33mList\u001b[0m(Failure(java.lang.NumberFormatException: For input string: \"nan\"))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "safe.CSVReader[Person].readCSVFromString(\"alice,nan\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Last look at the unsafe API, reading with malformed input"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mPerson\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Person(name: String, age: Int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres12\u001b[0m: \u001b[32mscala.List[cmd12.INSTANCE.$ref$cmd11.Person]\u001b[0m = \u001b[33mList\u001b[0m(\u001b[33mPerson\u001b[0m(\u001b[32m\"alice\"\u001b[0m, \u001b[32m1\u001b[0m))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "unsafe.CSVReader[Person].readCSVFromString(\"alice,1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As expected, malformed input raises exceptions:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "java.lang.NumberFormatException: For input string: \"nan\"",
      "\tjava.lang.NumberFormatException.forInputString(NumberFormatException.java:65)",
      "\tjava.lang.Integer.parseInt(Integer.java:580)",
      "\tjava.lang.Integer.parseInt(Integer.java:615)",
      "\tscala.collection.immutable.StringLike$class.toInt(StringLike.scala:272)",
      "\tscala.collection.immutable.StringOps.toInt(StringOps.scala:30)",
      "\tpurecsv.unsafe.converter.defaults.string.package$$anonfun$11.apply(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.string.package$$anonfun$11.apply(package.scala:39)",
      "\tpurecsv.unsafe.converter.StringConverterUtils$$anon$1.from(Converter.scala:47)",
      "\tpurecsv.unsafe.converter.StringConverterUtils$$anon$1.from(Converter.scala:46)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:36)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:36)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$3.from(package.scala:48)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$3.from(package.scala:47)",
      "\tpurecsv.unsafe.package$CSVReader$$anonfun$readCSVFromReader$1.apply(package.scala:66)",
      "\tpurecsv.unsafe.package$CSVReader$$anonfun$readCSVFromReader$1.apply(package.scala:66)",
      "\tscala.collection.Iterator$$anon$11.next(Iterator.scala:370)",
      "\tscala.collection.Iterator$class.foreach(Iterator.scala:750)",
      "\tscala.collection.AbstractIterator.foreach(Iterator.scala:1202)",
      "\tscala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)",
      "\tscala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:183)",
      "\tscala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45)",
      "\tscala.collection.TraversableOnce$class.to(TraversableOnce.scala:295)",
      "\tscala.collection.AbstractIterator.to(Iterator.scala:1202)",
      "\tscala.collection.TraversableOnce$class.toList(TraversableOnce.scala:279)",
      "\tscala.collection.AbstractIterator.toList(Iterator.scala:1202)",
      "\tpurecsv.unsafe.package$CSVReader$class.readCSVFromString(package.scala:70)",
      "\tpurecsv.unsafe.package$CSVReader$$anon$1.readCSVFromString(package.scala:89)",
      "\tcmd13$$user$$anonfun$1.apply(Main.scala:46)",
      "\tcmd13$$user$$anonfun$1.apply(Main.scala:45)"
     ]
    }
   ],<commit_msg>Java 1.7.0_76 exception trace in tested example<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# PureCSV demo\n",
    "\n",
    "*A (shapeless-based) type-safe and boilerplate-free CSV library for Scala*\n",
    "\n",
    "https://github.com/melrief/PureCSV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's load it from sonatype, as indicated on the [PureCSV](https://github.com/melrief/PureCSV) page.\n",
    "\n",
    "Ignore the (annoying) Ivy resolution output - everything goes just well."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "test_ignore": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ":: problems summary ::\n",
      ":::: WARNINGS\n",
      "\tUnable to reparse com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT from sonatype-snapshots, using Fri May 22 10:44:01 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT, using Fri May 22 10:44:01 CEST 2015 and Fri May 22 10:44:01 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT, using Fri May 22 01:49:14 CEST 2015 and Fri May 22 01:49:14 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault.jupyter#jupyter-scala-api_2.11.6;0.2.0-SNAPSHOT\n",
      "\n",
      "\tUnable to reparse com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT from sonatype-snapshots, using Fri May 22 03:13:14 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT, using Fri May 22 03:13:14 CEST 2015 and Fri May 22 03:13:14 CEST 2015\n",
      "\n",
      "\tSorting results from com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT, using Fri May 22 01:56:25 CEST 2015 and Fri May 22 01:56:25 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault#ammonite-api_2.11.6;0.3.1-SNAPSHOT\n",
      "\n",
      "\tUnable to reparse com.github.alexarchambault.jupyter#jupyter-api_2.11;0.2.0-SNAPSHOT from sonatype-snapshots, using Thu May 21 21:38:28 CEST 2015\n",
      "\n",
      "\tChoosing sonatype-snapshots for com.github.alexarchambault.jupyter#jupyter-api_2.11;0.2.0-SNAPSHOT\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "load.ivy(\"com.github.melrief\" %% \"purecsv\" % \"0.0.1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Examples from the PureCSV README"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[32mimport \u001b[36mpurecsv._\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import purecsv._"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Simple example, using *unsafe* (= exception prone) API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mEvent\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Event(ts: Long, msg: String)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mrecords\u001b[0m: \u001b[32mscala.List[cmd3.INSTANCE.$ref$cmd2.Event]\u001b[0m = \u001b[33mList\u001b[0m(\u001b[33mEvent\u001b[0m(\u001b[32m1\u001b[0mL, \u001b[32m\"foo\"\u001b[0m), \u001b[33mEvent\u001b[0m(\u001b[32m2\u001b[0mL, \u001b[32m\"bar\"\u001b[0m))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "val records = unsafe.CSVReader[Event].readCSVFromString(\"1,foo\\n2,bar\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres4\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"\"\"\n",
       "1,\"foo\"\n",
       "2,\"bar\"\n",
       "\"\"\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import unsafe._; records.toCSV() }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Now with the safe API, writing CSV..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mInterval\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "class Interval(val start: Long, val end: Long)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres6\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"10,20\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import safe._; new Interval(10,20).toCSV() }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres7\u001b[0m: \u001b[32mString\u001b[0m = \u001b[32m\"\"\"\n",
       "1|10\n",
       "11|20\n",
       "\"\"\"\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "{ import safe._; Seq(new Interval(1,10),new Interval(11,20)).toCSV(\"|\") }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### ... and reading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mPerson\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Person(name: String, age: Int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres9\u001b[0m: \u001b[32mscala.List[scala.util.Try[cmd9.INSTANCE.$ref$cmd8.Person]]\u001b[0m = \u001b[33mList\u001b[0m(Success(Person(alice,1)))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "safe.CSVReader[Person].readCSVFromString(\"alice,1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres10\u001b[0m: \u001b[32mscala.List[scala.util.Try[cmd10.INSTANCE.$ref$cmd8.Person]]\u001b[0m = \u001b[33mList\u001b[0m(Failure(java.lang.NumberFormatException: For input string: \"nan\"))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "safe.CSVReader[Person].readCSVFromString(\"alice,nan\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Last look at the unsafe API, reading with malformed input"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defined \u001b[32mclass \u001b[36mPerson\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "case class Person(name: String, age: Int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[36mres12\u001b[0m: \u001b[32mscala.List[cmd12.INSTANCE.$ref$cmd11.Person]\u001b[0m = \u001b[33mList\u001b[0m(\u001b[33mPerson\u001b[0m(\u001b[32m\"alice\"\u001b[0m, \u001b[32m1\u001b[0m))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "unsafe.CSVReader[Person].readCSVFromString(\"alice,1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As expected, malformed input raises exceptions:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "java.lang.NumberFormatException: For input string: \"nan\"",
      "\tjava.lang.NumberFormatException.forInputString(NumberFormatException.java:65)",
      "\tjava.lang.Integer.parseInt(Integer.java:492)",
      "\tjava.lang.Integer.parseInt(Integer.java:527)",
      "\tscala.collection.immutable.StringLike$class.toInt(StringLike.scala:272)",
      "\tscala.collection.immutable.StringOps.toInt(StringOps.scala:30)",
      "\tpurecsv.unsafe.converter.defaults.string.package$$anonfun$11.apply(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.string.package$$anonfun$11.apply(package.scala:39)",
      "\tpurecsv.unsafe.converter.StringConverterUtils$$anon$1.from(Converter.scala:47)",
      "\tpurecsv.unsafe.converter.StringConverterUtils$$anon$1.from(Converter.scala:46)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:36)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:39)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$2.from(package.scala:36)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$3.from(package.scala:48)",
      "\tpurecsv.unsafe.converter.defaults.rawfields.package$$anon$3.from(package.scala:47)",
      "\tpurecsv.unsafe.package$CSVReader$$anonfun$readCSVFromReader$1.apply(package.scala:66)",
      "\tpurecsv.unsafe.package$CSVReader$$anonfun$readCSVFromReader$1.apply(package.scala:66)",
      "\tscala.collection.Iterator$$anon$11.next(Iterator.scala:370)",
      "\tscala.collection.Iterator$class.foreach(Iterator.scala:750)",
      "\tscala.collection.AbstractIterator.foreach(Iterator.scala:1202)",
      "\tscala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)",
      "\tscala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:183)",
      "\tscala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45)",
      "\tscala.collection.TraversableOnce$class.to(TraversableOnce.scala:295)",
      "\tscala.collection.AbstractIterator.to(Iterator.scala:1202)",
      "\tscala.collection.TraversableOnce$class.toList(TraversableOnce.scala:279)",
      "\tscala.collection.AbstractIterator.toList(Iterator.scala:1202)",
      "\tpurecsv.unsafe.package$CSVReader$class.readCSVFromString(package.scala:70)",
      "\tpurecsv.unsafe.package$CSVReader$$anon$1.readCSVFromString(package.scala:89)",
      "\tcmd13$$user$$anonfun$1.apply(Main.scala:46)",
      "\tcmd13$$user$$anonfun$1.apply(Main.scala:45)"
     ]
    }
   ],
{'fraction_non_alphanumeric': 0.19549128030625265, 'fraction_numerical': 0.060782645682688215, 'mean_word_length': 2.784162240463544, 'pattern_counts': {'":': 344, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5427650', 'n_tokens_mistral': 10217, 'n_tokens_neox': 9222, 'n_words': 1172}