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
We have previously added from_dict and to_dict, but it has proven to be of limited use, since it is too specific to scipp's data schemas. For better interaction with other common libraries in the Python ecosystem, we should add from_pandas and from_xarray.
to_pandas and to_xarray may be added as a second step, but they are more tricky since there may be scipp features that cannot be represented in those libraries. So let us start with:
from_xarray:
Support DataArray and Dataset
data maps to values
can we handle units? xarray does not support specifics, so unless we want to rely on xarray attributes with specific names we have the set them as dimensionless in scipp
Note that xarray attributes have no direct equivalent in scipp. Attributes of xarray data arrays or dataset may be stored as scalar variables in scipp attributes.
xarray distinguishes coord with and without index. Coords with index should map to scipp coords, coords without index to attributes.
from_pandas:
Not too familiar with this, need to check if there is a way to identify columns as coords
Overall, it is probably best to start simple. Some of the details above (such as attr or unit handling) can be done later, no need to get everything working in the first pull-request.
Instead of implementing from_pandas, we might choose to simply use from_xarray(xr.Dataset.from_dataframe). Downside is that the user would need to install xarray, but if it avoids a lot of code it may be the best choice for now.
We have previously added
from_dict
andto_dict
, but it has proven to be of limited use, since it is too specific to scipp's data schemas. For better interaction with other common libraries in the Python ecosystem, we should addfrom_pandas
andfrom_xarray
.to_pandas
andto_xarray
may be added as a second step, but they are more tricky since there may be scipp features that cannot be represented in those libraries. So let us start with:from_xarray
:DataArray
andDataset
values
from_pandas
:Overall, it is probably best to start simple. Some of the details above (such as attr or unit handling) can be done later, no need to get everything working in the first pull-request.
See also:
from_pandas
http://xarray.pydata.org/en/stable/generated/xarray.Dataset.from_dataframe.htmlThe text was updated successfully, but these errors were encountered: