home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 330282841

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1317#issuecomment-330282841 https://api.github.com/repos/pydata/xarray/issues/1317 330282841 MDEyOklzc3VlQ29tbWVudDMzMDI4Mjg0MQ== 1386642 2017-09-18T16:45:55Z 2017-09-18T16:46:37Z CONTRIBUTOR

@shoyer I wrote a class that does this a while ago. It is available here: data_matrix.py. It is used like this ```python

D is a dataset

the signature for DataMatrix.init is

DataMatrix(feature_dims, sample_dims, variables)

mat = DataMatrix(['z'], ['x'], ['a', 'b']) y = mat.dataset_to_mat(D) x = mat.mat_to_dataset(y) `` One of the problems I had to handle was with concatenating/stacking DataArrays with different numbers of dimensions---stackandunstackcombined withto_arraycan only handle the case where the desired feature variables all have the same dimensionality. ATM my code stacks the desired dimensions for each variable and then manually callsnp.hstack` to produce the final matrix, but I bet it would be easy to create a pandas Index object which can handle this use case.

Would you be open to a PR along these lines?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  216215022
Powered by Datasette · Queries took 0.612ms · About: xarray-datasette