JuliaData / DataFrames.jl

In-memory tabular data in Julia
https://dataframes.juliadata.org/stable/
Other
1.74k stars 367 forks source link

Make DataVec's vertical #89

Closed johnmyleswhite closed 11 years ago

johnmyleswhite commented 11 years ago

At present DataVec's don't ever interact with DataMatrix's, so we haven't needed to be careful about the horizontal or vertical orientation of a DataVec. Our current show() method makes a DataVec look horizontal, but the structure should probably be vertical for consistency with Julia's standard vectors.

HarlanH commented 11 years ago

I'm not sure I agree with this. Julia vectors are vertical to reinforce the ordering of matrices, I think. That's not important for us to reinforce. And from the point of view of interactive data analysis, wasting all of that space doesn't sound like a good idea. On Nov 30, 2012 7:05 PM, "John Myles White" notifications@github.com wrote:

At present DataVec's don't ever interact with DataMatrix's, so we haven't needed to be careful about the horizontal or vertical orientation of a DataVec. Our current show() method makes a DataVec look horizontal, but the structure should probably be vertical for consistency with Julia's standard vectors.

— Reply to this email directly or view it on GitHubhttps://github.com/HarlanH/DataFrames.jl/issues/89.

johnmyleswhite commented 11 years ago

If DataVec's are horizontal, what direction does their transpose go in?

And if they're horizontal, why are they printed vertically inside of DataFrame's?

HarlanH commented 11 years ago

To me, direction for a DV is barely relevant. It's just an array. We can print it either way. But yes, a DF is vertical, because that's the standard for database table output, and because most useful DFs will have more rows than columns, so it looks better in that direction. For a DV, it looks better horizontally, I think. On Nov 30, 2012 7:25 PM, "John Myles White" notifications@github.com wrote:

If DataVec's are horizontal, what direction does their transpose go in?

And if they're horizontal, why are they printed vertically inside of DataFrame's?

— Reply to this email directly or view it on GitHubhttps://github.com/HarlanH/DataFrames.jl/issues/89#issuecomment-10909664.

johnmyleswhite commented 11 years ago

Ok. I don't have very strong feelings on this, but do think that verticality will turn out to be a helpful mnemonic when we have DataArray's. Let's revisit this then.

HarlanH commented 11 years ago

Ok. On Nov 30, 2012 7:31 PM, "John Myles White" notifications@github.com wrote:

Ok. I don't have very strong feelings on this, but do think that verticality will turn out to be a helpful mnemonic when we have DataArray's. Let's revisit this then.

— Reply to this email directly or view it on GitHubhttps://github.com/HarlanH/DataFrames.jl/issues/89#issuecomment-10909787.

StefanKarpinski commented 11 years ago

I rather feel like DataVecs should print like vectors. I know it seems like a waste of space, but I think it's right.

johnmyleswhite commented 11 years ago

For me the following code (which now is in my branch of DataFrames) settles the case for why we should make DataVec's vertical:

{DataVec(squeeze(m[:,i])) for i = 1:size(m, 2)}

That prints something that looks like an array, but the real "array" is actually the transpose of what you see on the screen when you print DataVec's horizontally.

StefanKarpinski commented 11 years ago

I feel somewhat strongly that making all vectorish things vertical seems like a good idea.

johnmyleswhite commented 11 years ago

I just changed this on my branch and like how it looks.

HarlanH commented 11 years ago

I'm outvoted. :) And in OSS, actually writing code is 9/10ths of the law.

johnmyleswhite commented 11 years ago

The tyranny of democracy wins again! Now that we've got basically functional DataMatrix objects, I think the visual consistency is going to be helpful. If we succeed at getting DataVec to inherit from AbstractVector we'll also inherit vertical printing by default.