Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printing of large datashapes #379

Open
mrocklin opened this issue Oct 11, 2015 · 3 comments
Open

Pretty printing of large datashapes #379

mrocklin opened this issue Oct 11, 2015 · 3 comments

Comments

@mrocklin
Copy link

Large nested datashapes can be troublesome for humans to parse if printed linearly. Consider the following data

In [11]: x
Out[11]: 
nd.array([],
         type="0 * {actor : {avatar_url : string, gravatar_id : string, id : int64, 
login : string, url : string}, created_at : datetime, id : int64, payload : {before : 
string, commits : 1 * {author : {email : string, name : string}, distinct : bool, 
message : string, sha : string, url : string}, distinct_size : int64, head : string, 
push_id : int64, ref : string, size : int64}, public : bool, repo : {id : int64, name : 
string, url : string}, type : string}")

It's really not clear what's going on here. If we print things in a nested way then the situation becomes more clear.

{
  actor: {
    avatar_url: string,
    gravatar_id: string,
    id: int64,
    login: string,
    url: string
    },
  created_at: datetime,
  id: int64,
  payload: {
    before: string,
    commits: 1 * {
      author: {email: string, name: string},
      distinct: bool,
      message: string,
      sha: string,
      url: string
      },
    distinct_size: int64,
    head: string,
    push_id: int64,
    ref: string,
    size: int64
    },
  public: bool,
  repo: {id: int64, name: string, url: string},
  type: string
  }
@mrocklin
Copy link
Author

datashape.coretypes:pprint() may be of some value here when designing a solution for dynd.

https://github.com/blaze/datashape/blob/master/datashape/coretypes.py#L1238-L1317

@izaid
Copy link
Member

izaid commented Oct 11, 2015

Thanks, this clearly needs to happen, and the datashape link is great. Will let you know when it has.

@mwiebe
Copy link
Member

mwiebe commented Oct 12, 2015

I think the datashape formatting in https://github.com/libdynd/libdynd/blob/master/include/dynd/types/datashape_formatter.hpp with multiline=true might be pretty close to this already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants