[Feature] pretty prints of objects
See original GitHub issue🚨🚨 Feature Request
If your feature will improve HUB
To explore the structure of a dataset it is convenient to have nicer and more informative prints of dataset objects and samples
Description of the possible solution
1) show ds
now
> ds
Dataset(path='hub://activeloop/abalone_full_dataset', tensors=['length', 'diameter', 'height', 'weight'])
Something along the lines would work (taken from SQLlite)
> ds.height
path: "hub://activeloop/abalone_full_dataset", samples: 1532596
tensor htype dtype shape compression
------ ------ ------ ------ -----------
length image uint8 256x256x3 jpeg
diameter image float32 512x512x3 zstd
height image float32 512x512x3 zstd
weight class_label int32 32 None
and in jupyter notebook shown as a table similar to pandas
2) show ds.tensor
now
> ds.height
Tensor(key='Length')
at least provide full information about tensor
> ds.height
Tensor(
key='height',
htype='image',
dtype='uint8',
shape=(256, 256, 3),
sample_compression='jpeg'
)
or to make consistent with 1)
> ds.height
tensor htype dtype shape compression
------ ------ ------ ------ -----------
height image float32 512x512x3 zstd
2) show ds[0:5] sample
> ds[0:5]
length diameter height weight
------ -------- ------ ------
0 0.5 [[0.,...,0]] "sent.." dog
0 0.5 [[0.,...,0]] "text a" dog
0 0.5 [[0.,...,0]] "text b" dog
and in jupyter notebook visualize images (and other htypes)
Notes
- Feel free to provide a better format for printing dataset, tensor and sample classes
- Feel free to suggest other important classes/objects need to printed properly for exploring the structure
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (10 by maintainers)
Top Results From Across the Web
Prettify Your Data Structures With Pretty Print in Python
The pprint module, Python's data pretty printer, is a useful part of the standard library. You can work with it for debugging data...
Read more >pprint — Data pretty printer — Python 3.11.1 documentation
The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the...
Read more >Data::Printer - colored & full-featured pretty print ... - MetaCPAN
This function pretty-prints the contents of whatever variable to STDERR (by default), and will use colors by default if your terminal supports it....
Read more >which objects does Pry print pretty? · Issue #422 - GitHub
At the moment pry pretty prints using the pretty_inspect function and then piping the result through CodeRay to highlight it like ruby code, ......
Read more >Pretty Print a JSON File in Python (6 Methods) - Datagy
One of the parameters of the function allows us to customize the indent that we want our JSON object to be indented with....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@davidbuniat @FayazRahman @mikayelh I have been working on generating below output. I would push the code for the both table and schema soon.
Any updates on below outputs will help solve the issue quickly.
Command Line Output:
Jupyter Notebook Output:
Sure @davidbuniat. I’ll integrate the code in hub and raise these doubts in that PR. Thanks for clarifying and sharing feedback!