Repository: ticdat/ticdat (language: python)

Issue:
Minor tweak to examples
Keep up or fall behind....
_clean_unneeded_columns useful for writing PanDatFactory back to file system or database
`PanDat` objects aren't structured as rigidly as `TicDat` objects. They are just collections of `DataFrames` that have the required fields.
When writing a `PanDat` the dataframes might have excess columns if the DataFrame was created by some complex solve process instead of being created by a `PanDatFactory`. Such an object would be recognized as "good" as long as it had all the required fields. There is nothing inherently wrong with letting a `ticdat` developer create a `PanDat` object that has extra columns. That said, those should extra columns should be pruned off before writing. None of the writers do this now, but mayhem resulted  when a solver generated a scenario_id column that was then written back to enframe (since scenario_id is a reserved column on Enframe).

As an aside, note that a data scientist working with enframe could easily create such mayhem simply by writing the same sort of solver routine and then using `pandas` to write directly to Enframe, instead of writing via `ticdat`. 


Discussion / hints:

Fix patch:
diff --git a/ticdat/utils.py b/ticdat/utils.py
index a1d8d24..9a47e9b 100644
--- a/ticdat/utils.py
+++ b/ticdat/utils.py
@@ -12,7 +12,7 @@
 from collections import namedtuple
 import datetime as datetime_
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil = None
 


Test patch:
diff --git a/ticdat/testing/test_pgtd.py b/ticdat/testing/test_pgtd.py
index 3831db6..d5b176c 100644
--- a/ticdat/testing/test_pgtd.py
+++ b/ticdat/testing/test_pgtd.py
@@ -21,7 +21,7 @@
 except:
     pd = None
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil = None
 
diff --git a/ticdat/testing/testcsv.py b/ticdat/testing/testcsv.py
index 0d08284..e847e80 100644
--- a/ticdat/testing/testcsv.py
+++ b/ticdat/testing/testcsv.py
@@ -12,7 +12,7 @@
 from ticdat.csvtd import _can_unit_test
 import datetime
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil=None
 
diff --git a/ticdat/testing/testjson.py b/ticdat/testing/testjson.py
index 2407399..50c173d 100644
--- a/ticdat/testing/testjson.py
+++ b/ticdat/testing/testjson.py
@@ -9,7 +9,7 @@
 from ticdat.jsontd import _can_unit_test, json
 import datetime
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil=None
 
diff --git a/ticdat/testing/testpandat_io.py b/ticdat/testing/testpandat_io.py
index d92df0e..db85a52 100644
--- a/ticdat/testing/testpandat_io.py
+++ b/ticdat/testing/testpandat_io.py
@@ -17,7 +17,7 @@
     numpy = pd = None
 import math
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil = None
 import datetime
diff --git a/ticdat/testing/testsql.py b/ticdat/testing/testsql.py
index 687ced0..80d9c2c 100644
--- a/ticdat/testing/testsql.py
+++ b/ticdat/testing/testsql.py
@@ -9,7 +9,7 @@
 from ticdat.sqlitetd import _can_unit_test, sql
 import datetime
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil=None
 
diff --git a/ticdat/testing/testutils.py b/ticdat/testing/testutils.py
index b3e5ff6..1d34c0d 100644
--- a/ticdat/testing/testutils.py
+++ b/ticdat/testing/testutils.py
@@ -12,7 +12,7 @@
 import shutil
 import json
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil = None
 import datetime
diff --git a/ticdat/testing/testxls.py b/ticdat/testing/testxls.py
index ad82da9..a723350 100644
--- a/ticdat/testing/testxls.py
+++ b/ticdat/testing/testxls.py
@@ -10,7 +10,7 @@
 import unittest
 import datetime
 try:
-    import dateutil
+    import dateutil, dateutil.parser
 except:
     dateutil=None