You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [32]: xray.Dataset(df)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-32-358846bebb6d> in <module>()
----> 1 xray.Dataset(df)
/Users/shoyer/dev/xray/xray/core/dataset.pyc in __init__(self, data_vars, coords, attrs, compat, **kwargs)
206 if coords is None:
207 coords = set()
--> 208 if data_vars or coords:
209 self._set_init_vars_and_dims(data_vars, coords, compat)
210 if attrs is not None:
/Users/shoyer/miniconda/envs/chinook-py2/lib/python2.7/site-packages/pandas/core/generic.pyc in __nonzero__(self)
712 raise ValueError("The truth value of a {0} is ambiguous. "
713 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
--> 714 .format(self.__class__.__name__))
715
716 __bool__ = __nonzero__
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
But there's no reason why this shouldn't work. After #671, this is as simple as converting the DataFrame or Series to an OrderedDict first:
In [31]: xray.Dataset(OrderedDict(df))
Out[31]:
<xray.Dataset>
Dimensions: (x: 3)
Coordinates:
* x (x) object 'a' 'b' 'c'
Data variables:
y (x) int64 0 1 2
In [34]: xray.Dataset(OrderedDict(df.y))
Out[34]:
<xray.Dataset>
Dimensions: ()
Coordinates:
*empty*
Data variables:
a int64 0
b int64 1
c int64 2
The text was updated successfully, but these errors were encountered:
Currently, this fails:
But there's no reason why this shouldn't work. After #671, this is as simple as converting the DataFrame or Series to an OrderedDict first:
The text was updated successfully, but these errors were encountered: