Comments (12)
Sorry, I meant the error at the call of foo
, which requires two arguments.
The behavior you described is the correct behavior. I believe Cols(:x1, :x1)
should be equivalent to [:x1]
.
from dataapi.jl.
CC @pdeffebach, @CameronBieganek
from dataapi.jl.
To clarify the issue is as follows, right?
function foo(x, y)
x .+ y .- mean(x)
end
- Case 1:
select(df, Cols(:x1, :x1) => foo)
errors - Case 2:
select(df, Cols(:x1, :x1) => foo)
works.
My intuition is to throw an error. Given that Cols
promises no guarantee of ordering in the vast majority of scenarios, the user shouldn't rely on a 1:1 behavior of Cols
in this context. They can do
select(df, [:x1, :x1] => foo)
If they want, right?
from dataapi.jl.
@pdeffebach No, the idea is that if it didn't error, Cols(:x1, :x1)
would be equivalent to [:x1]
(contrary to [:x1, :x1]
).
As usual, we can throw an error for now and relax the rules later if needed.
from dataapi.jl.
I believe
Cols(:x1, :x1)
should be equivalent to[:x1]
.
What is the benefit of allowing this over throwing an error?
from dataapi.jl.
I guess it could make sense if these are stored in variables which can take multiple values. Though half of the time it would probably indicate a bug and you can always call unique
first.
from dataapi.jl.
What is the benefit of allowing this over throwing an error?
I think it would be frustrating for users if
Cols(x #= Container which contains :x1 =#, y #= Container which contains :x1=#) # Between(), etc.
worked but not
Cols(:x1, :x1)
from dataapi.jl.
half of the time it would probably indicate a bug
This is my understanding of the situation, but given there is no support for it it is even easier to have Cols
behave by always taking a union.
from dataapi.jl.
Cols(:x1, :x1) == Cols(:x1)
makes sense to me. That's consistent with the
Cols(A, B, C) ==> (A, B\A, C\(A ∪ B))
behavior I mentioned in the other thread.
from dataapi.jl.
It is consistent when A
, B
, C
are sets. I considered :x1
to be a separate case as it is not a set but a set element.
from dataapi.jl.
I'm willing to consider :x1
to be a set with one element. I'd hate to have to write [:x1]
all the time. 🙂
from dataapi.jl.
I don't have a strong opinion here, but I would say it's fine to allow it. If one of them is not a symbol literal, this could be useful (say Cols(:x1, col)
and col
is set programmatically).
The only analogous thing I can think of is for example repeated named arguments in julia Base, and there they are only forbidden if they are passed "not programmatically":
julia> (; a = 1, a = 2)
ERROR: syntax: field name "a" repeated in named tuple
Stacktrace:
[1] top-level scope at REPL[1]:1
[2] eval(::Module, ::Any) at ./boot.jl:331
[3] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
[4] run_backend(::REPL.REPLBackend) at /home/pietro/.julia/packages/Revise/WkyNB/src/Revise.jl:1023
[5] top-level scope at none:0
julia> (; a = 1, :a => 2)
(a = 2,)
As we do not have a good way to test if the symbol was a literal or came from some variable, the simplest is probably to just allow it.
from dataapi.jl.
Related Issues (20)
- `Between` should accept more than `Int` and `Symbol` HOT 2
- `metadata` method HOT 70
- isordered HOT 4
- Deprecate `All` HOT 9
- TagBot trigger issue HOT 20
- ellipsis notation for Beetwen HOT 4
- Plan for 1.7 release
- Add flatten to DataAPI.jl HOT 6
- Add `Selector` abstract type for ecosytem compat, and rethink `Between` HOT 8
- Change describe contract HOT 2
- add kwarg to levels to keep missing
- nrow and ncol for undefined values HOT 1
- clarify Between HOT 1
- Add method for iterating metadata HOT 8
- a few concerns about metadata methods HOT 8
- Confusing `levels` fallback HOT 9
- default to metadata! style=:default HOT 6
- Define `rename` and `rename!` for modifying column names? HOT 3
- Don't define unwrap(x::Any) HOT 7
- rownumber HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataapi.jl.