how to print out part of a row in DataFrame?

346 views
Skip to first unread message

cnbiz850

unread,
Jun 9, 2014, 7:43:12 PM6/9/14
to julia...@googlegroups.com
I only got the following formatted display but not my values. To me
this is really not desired, does everyone prefer this?

Can I get a printout of the values just as I print out a row of an array?

julia> println(df[jj, 1:20])
1x20 DataFrame
|-------|------|--------|---------|
| Col # | Name | Eltype | Missing |
| 1 | x1 | Int64 | 0 |
| 2 | x2 | Int64 | 0 |
| 3 | x3 | Int64 | 0 |
| 4 | x4 | Int64 | 0 |
| 5 | x5 | Int64 | 0 |
| 6 | x6 | Int64 | 0 |
| 7 | x7 | Int64 | 0 |
| 8 | x8 | Int64 | 0 |
| 9 | x9 | Int64 | 0 |
| 10 | x10 | Int64 | 0 |
| 11 | x11 | Int64 | 0 |
| 12 | x12 | Int64 | 0 |
| 13 | x13 | Int64 | 0 |
| 14 | x14 | Int64 | 0 |
| 15 | x15 | Int64 | 0 |
| 16 | x16 | Int64 | 0 |
| 17 | x17 | Int64 | 0 |
| 18 | x18 | Int64 | 0 |
| 19 | x19 | Int64 | 0 |
| 20 | x20 | Int64 | 0 |

John Myles White

unread,
Jun 9, 2014, 10:38:05 PM6/9/14
to julia...@googlegroups.com
I’ve changed the default printing rule to show all columns. As some point, we’ll need to clean it up so that we don’t print crazy amounts of ouptut if you have thousands of columns or more.

— John

Taylor Maxwell

unread,
Jun 9, 2014, 10:42:48 PM6/9/14
to julia...@googlegroups.com
If your dataframe has 6 or more columns then it prints this summary.  If you index less than 6 columns it will print ok.  You can force it to spit it all out with showall(df) but that may not be entirely legible.   There may be other ways to display it.

John Myles White

unread,
Jun 9, 2014, 10:43:46 PM6/9/14
to julia...@googlegroups.com
Yup, this is the behavior that just got removed since we’ve had so many complaints.

— John

Taylor Maxwell

unread,
Jun 9, 2014, 10:43:48 PM6/9/14
to julia...@googlegroups.com
scratch what I just said

cnbiz850

unread,
Jun 9, 2014, 11:09:17 PM6/9/14
to julia...@googlegroups.com
Thanks John for the update. Do I need to do a clone to get the new change?

I think there are two issues here. One is to display df, a row of it,
or part of a row, like

julia> df
julia> df[3, 1:20]

The other is to print out (to the terminal or to a file).

On the first issue, I hope DataFrames can adopt a similar behavior of
arrays (when the user tries to display an array that is large, julia
prints out ... in between the data). This is not only helpful to the
user but is also consistent with the overall julia style.

On the second, if an entire df is to be printed to the terminal, perhaps
it should opt to print a summary only. If a row is to be printed, it
should always print out the data, however many elements.

John Myles White

unread,
Jun 9, 2014, 11:17:58 PM6/9/14
to julia...@googlegroups.com
You can either sync with master or wait until we do an official release.

I’m pretty happy with how DataFrames are printed now.

Because there’s no substantive distinction between a DataFrame, a row of a DataFrame or part of a row, we print them the same way. I don’t really see why we should change that.

Being more consistent with Base makes sense, but DataFrames aren’t arrays and I wouldn’t want people to think they are. The distict printing helps to reinforce an important conceptual distinction.

We also just turned off printing out summaries because so many people have voiced complaints about it. I’m not sure we should reinstate it, since it causes confusion all the time. Even people who sort of understand the rules for printing didn’t really understand them: it seemed to be the kind of thing that only made sense to people who’d read the source code.

— John
Reply all
Reply to author
Forward
0 new messages