-
Notifications
You must be signed in to change notification settings - Fork 368
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
add displaycoltypes to showrows & show for dataframes #2142
Conversation
Thank you for the contribution. I will review this PR after #2140 is merged (to avoid duplicate work on your side). The one thing that should be fixed in the PR is that when we omit printing eltypes then eltype row should not be considered when calculating column width (now you only disabled printing it, but still it is considered to determine with of the column - which is visible in your examples). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I just have a few small comments, I'll leave it to @bkamins to check implementation tricks.
Regarding the name, maybe it should be eltypes
, as these are not really the types of columns themselves?
src/abstractdataframe/show.jl
Outdated
@@ -607,6 +619,7 @@ while `splitcols` defaults to `true`. | |||
By default this is the case only if `io` has the `IOContext` property `limit` set. | |||
- `rowlabel::Symbol = :Row`: The label to use for the column containing row numbers. | |||
- `summary::Bool = true`: Whether to print a brief string summary of the data frame. | |||
- `coltypes::Bool = true`: Whether to print the column types under column names in data frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `coltypes::Bool = true`: Whether to print the column types under column names in data frame. | |
- `coltypes::Bool = true`: Whether to print the column types under column names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 052de9a
src/abstractdataframe/show.jl
Outdated
@@ -390,6 +395,8 @@ NOTE: The value of `maxwidths[end]` must be the string width of | |||
- `displaysummary::Bool`: Should a brief string summary of the | |||
AbstractDataFrame be rendered to the I/O stream before printing the | |||
contents of the renderable rows? Defaults to `true`. | |||
- `displaycoltype::Bool = true`: Whether to print the column type | |||
under the column name in the heading. Defaults to true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
under the column name in the heading. Defaults to true. | |
under the column name in the heading. Defaults to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 052de9a
src/abstractdataframe/show.jl
Outdated
@@ -131,7 +132,6 @@ function getmaxwidths(df::AbstractDataFrame, | |||
for (name, col) in pairs(eachcol(df)) | |||
# (1) Consider length of column name | |||
maxwidth = ourstrwidth(io, name) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, please revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 052de9a
OK - I will have a final look when the changes by @nalimilan are incorporated. |
okay, @nalimilan comments should have been addressed in 052de9a |
OK. As I have expected you have merge conflicts now due to #2140. Can you please rebase the PR and then the following things should be done before it is merged:
I hope this list is not too long, but we need to keep things in sync with displaying things (and astonishingly these things tend to be more complex than they seem to be). |
Thank you for the update. What about the comment of @nalimilan to use Other than that - the PR looks good. Can you just please check if we correctly adjust the number of rows to be printed (if we do not print eltypes then we have one more line available)? And we still need tests and possibly some manual entry. |
@bkamins sorry! I pushed without thinking! Give me a couple more days and ill try to get this in order. |
No problem. Thank you for working on that! |
@bkamins the most recent commits should hopefully address the issues:
|
Thank you. Apart from comments we should have tests for text/plain, HTML and LaTeX for Thank you! |
OK - so we are left with adding |
Yes sorry about this! please go ahead and make another PR! |
@nalimilan - I think we can merge it if you are OK with this PR.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've committed a few suggestions. Looks good to me, thanks!
Thank you! |
For issue #2116 to have the types in the dataframe heading to be optional.
Added a boolean type
displaycoltypes
forshowrows
andcoltypes
torshow
insrc/abstractdataframe/show.jl
Testing
In the REPL: