Skip to content

Commit

Permalink
incremented version, added pydot as a dependency, and fixed issues with
Browse files Browse the repository at this point in the history
pandas
  • Loading branch information
ranchotexicana committed Sep 8, 2014
1 parent 28b37e9 commit e681420
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions mdf/builders/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def _get_labels(node, label=None, value=None):
label = _get_labels(node)[0]

# if value is a list return a label for each element
if isinstance(value, (tuple, list, np.ndarray, pa.Series, pa.Index)):
if isinstance(value, (tuple, list, np.ndarray, pa.core.generic.NDFrame, pa.Index)):
# if the label is a list already pad it to the right size
if isinstance(label, (tuple, list, np.ndarray, pa.Series, pa.Index)):
if isinstance(label, (tuple, list, np.ndarray, pa.core.generic.NDFrame, pa.Index)):
label = list(label)
if len(label) < len(value):
label += ["%s.%d" % (label, i) for i in xrange(len(label), len(value))]
Expand All @@ -43,13 +43,13 @@ def _get_labels(node, label=None, value=None):
return ["%s.%d" % (label, i) for i in xrange(len(value))]

# if value is not a list return a single label
if isinstance(label, (tuple, list, np.ndarray)):
if isinstance(label, (tuple, list, np.ndarray, pa.core.generic.NDFrame)):
return list(label[:1])
return [label]

# if there's no value but a label, assume the value is a scalar and return a single label
if label is not None:
if isinstance(label, (tuple, list, np.ndarray)):
if isinstance(label, (tuple, list, np.ndarray, pa.core.generic.NDFrame)):
return list(label[:1])
return [label]

Expand Down Expand Up @@ -227,7 +227,7 @@ def __call__(self, date, ctx):

if isinstance(value, (basestring, int, float, bool, datetime.date)):
self.handlers.append(self._write_basetype)
elif isinstance(value, (list, tuple, np.ndarray, pa.Index)):
elif isinstance(value, (list, tuple, np.ndarray, pa.Index, pa.core.generic.NDFrame)):
self.handlers.append(self._write_list)
elif isinstance(value, pa.Series):
self.handlers.append(self._write_series)
Expand Down Expand Up @@ -404,7 +404,7 @@ def __call__(self, date, ctx):
handler = NodeDictTypeHandler(node, filter=self.filter)
elif isinstance(node_value, pa.Series):
handler = NodeSeriesTypeHandler(node, filter=self.filter)
elif isinstance(node_value, (list, tuple, deque, np.ndarray, pa.Index)):
elif isinstance(node_value, (list, tuple, deque, np.ndarray, pa.Index, pa.core.generic.NDFrame)):
handler = NodeListTypeHandler(node, filter=self.filter)
else:
raise Exception("Unhandled type %s for node %s" % (type(node_value), node))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pyparsing
argparse
matplotlib
xlwt
pydot
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

version = '2.2'
version = '2.2.1'
cython_profile = False
cdebug = False

Expand Down

0 comments on commit e681420

Please sign in to comment.