Skip to content

Commit

Permalink
Omit target attribute if all are None (instead of storing nans)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnaul committed Oct 3, 2016
1 parent 4783290 commit 163fa40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cesium/featurize.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def assemble_featureset(feature_dicts, time_series=None, targets=None,
featureset = xr.Dataset(combined_feature_dict)
if names is not None:
featureset.coords['name'] = ('name', np.array(names))
if targets is not None:
if targets is not None and any(targets):
featureset.coords['target'] = ('name', np.array(targets))
return featureset

Expand Down
2 changes: 1 addition & 1 deletion cesium/tests/test_featurize.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ def test_featurize_time_series_no_targets():
scheduler=get_sync)
npt.assert_array_equal(sorted(fset.data_vars),
['amplitude', 'meta1', 'std_err'])
npt.assert_array_equal(fset.target.values, [None])
assert('target' not in fset)

0 comments on commit 163fa40

Please sign in to comment.