Tables.jl icon indicating copy to clipboard operation
Tables.jl copied to clipboard

Add `nrow` and `ncol`

Open rikhuijzer opened this issue 2 years ago • 6 comments

I noticed that there is a rowcount, but not a columncount and that length(columnnames(cols)) was used in the codebase to count the number of columns (because that is the fastest?). This PR suggests to add a columncount function.

rikhuijzer avatar Jun 29 '22 14:06 rikhuijzer

The DataAPI.jl defines nrow and ncol as a public API for this. rowcount is internal. If we are at it it would be probably better to properly implement default nrow and ncol implementations in this PR.

bkamins avatar Jun 29 '22 14:06 bkamins

If we are at it it would be probably better to properly implement default nrow and ncol implementations in this PR.

That would be great yes. Then Tables.jl sources can provide more efficient methods.

rowcount is internal.

How can I make nrow and ncol public for Tables.jl? I'm not sure what the convention is here

rikhuijzer avatar Jun 29 '22 15:06 rikhuijzer

How can I make nrow and ncol public for Tables.jl? I'm not sure what the convention is here

You do not need to do anything more than you did. Tables.jl does not export anything, but nrow and ncol are public because they implement public interface defined in DataAPI.jl.

bkamins avatar Jun 29 '22 15:06 bkamins

Codecov Report

Merging #285 (f094263) into main (60c080c) will decrease coverage by 0.55%. The diff coverage is 50.00%.

:exclamation: Current head f094263 differs from pull request most recent head acc8ac8. Consider uploading reports for the commit acc8ac8 to get more accurate results

@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
- Coverage   94.88%   94.32%   -0.56%     
==========================================
  Files           7        7              
  Lines         665      670       +5     
==========================================
+ Hits          631      632       +1     
- Misses         34       38       +4     
Impacted Files Coverage Δ
src/dicts.jl 92.66% <0.00%> (-1.74%) :arrow_down:
src/fallbacks.jl 97.90% <0.00%> (-0.69%) :arrow_down:
src/namedtuples.jl 98.66% <0.00%> (-1.34%) :arrow_down:
src/Tables.jl 88.00% <100.00%> (ø)
src/matrix.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 60c080c...acc8ac8. Read the comment docs.

codecov[bot] avatar Jun 29 '22 15:06 codecov[bot]

@bkamins @quinnj Is 5722256 going in the expected direction? Probably needs some more tests and I probably should implement a few more methods?

rikhuijzer avatar Jun 30 '22 07:06 rikhuijzer

@quinnj will know best if you correctly covered everything :), but for matrices things look good :).

bkamins avatar Jun 30 '22 07:06 bkamins