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

Setting the Options. Maximum number of rows to display #502

Open
kojix2 opened this issue Mar 27, 2019 · 5 comments
Open

Setting the Options. Maximum number of rows to display #502

kojix2 opened this issue Mar 27, 2019 · 5 comments

Comments

@kojix2
Copy link
Member

kojix2 commented Mar 27, 2019

Daru's data frame displays up to 30 rows.
I think the default threshold of 30 is reasonable in most cases.

However, when processing messy data, I often want to see 100 lines or more with my own eyes.

The threshold is defined as default values ​​for the arguments here.

def to_html(threshold=30)

So, you can change the threshold with the following patch.

class Daru::DataFrame
    alias_method :__to_html__, :to_html
    def to_html
        __to_html__(100)
    end
end

This is not a cool way.
I want a better way to configure Daru.

@kojix2 kojix2 changed the title How to set the maximum number of rows to display Setting the Options. Maximum number of rows to display Mar 27, 2019
@Shekharrajak
Copy link
Member

Yes! It makes sense. There was a similar discussion happened #476 , please have a look.

@kojix2
Copy link
Member Author

kojix2 commented Apr 2, 2019

My first idea is like

Daru.configure do |c|
  c.max_rows = 100
  c.max_columns = nil
end

But I think this is good too.

Daru::DataFrame.inspect_max_rows = 10
Daru::DataFrame.inspect_max_colms = nil
Daru::Vector.inspect_max_rows = nil 

@Shekharrajak
Copy link
Member

Thanks for letting me this. Yes! We can have configuration as well, where all these default things can be set.

@kojix2
Copy link
Member Author

kojix2 commented Apr 19, 2019

I realized that setting options alone was not enough for me.
I want to display a particular data frame / vector only once. For such use, a method like show_all may be more appropriate than config.

df.show_all

@Shekharrajak
Copy link
Member

Thanks for suggestion @kojix2 .

I think we should have global option to set the maximum number of rows to display as well as all_rows and all_colms property in dataframe level.

WDYT?

v0dro pushed a commit that referenced this issue May 30, 2020
* Add support for options to Daru module

#476

#502

* Use the max_rows option on the terminal

* fix typo in table formatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants