@davidanthoff How will this work for a situation like this:
@from i in df begin
@where i.Parking_Tax == true
@select i
@collect DataFrame
end
where the name of the column is “Parking Tax”. Previous version of DataFrames converted the name in “Parking_Tax” but not the latest version. So now I’m getting: type NamedTuple has no field Parking_Tax
I mean this does work but it’s part of a tutorial for beginners and it really makes things ugly and complicated:
@from i in df begin
@where getproperty(i, Symbol("Parking Tax")) == true
@select i
@collect DataFrame
end
Update 1
This is acceptable, but if there’s a better way, I’d be grateful to learn about it:
@from i in df begin
@where i[Symbol("Parking Tax")] == true
@select i
@collect DataFrame
end
Comprehensions have been previously introduced - but maybe you’re right and should be done with an iteration.
Edit 1:
Yes, definitely, good point! At least I can show the iteration and add that it can be done with a comprehension. Having the two versions side by side should clarify the comprehension syntax too.
I don’t have a better idea than what was posted here already… At the end of the day this boils down to how one can interact with named tuples in julia.
I do think a macro a la s"foo bar" that is equivalent to Symbol("foo bar") would be nice, but that should probably be done (if at all) in base…
I just wanted to give a shout out to my fellow S_str macro implementors. Working with data in the wild with lots of spaces in the column names I ended up independently stumbling upon this as well as a way to save lots of typing while not having to worry about normalization. If a critical mass of practitioners end up doing this maybe it should get a home of its own… somewhere.
The Query.jl story just depends on what is supported for standard named tuples. If base added support for x."field name" for named tuples, then one could use that syntax in Query.jl as well.
But I think base might think that x.var"field name" is good enough? That should work now already.