-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename SubDataFrame columns #3317
Comments
In general Before going to #3318 let us discuss what is the use-case you have and then we can decide how to meet your needs. Maybe what you need is:
? |
Hi Bogumił! :-) Thanks for asking So right now our use case is: I'm looking at your example and I'm surprised. Does DataFrame(SubDataFrame) copy data, or not? Anyway, to answer your question: The approach that you presented does indeed solve our problem, we will use it. (But let me just mention - in our specific use case data copying is the issue, not latency. But if latency was the issue, I'll just point out that the new approach is about 500x times faster (which again isn't our current problem)).
Thanks for your help :-) [1] DataFrames.jl/src/subdataframe/subdataframe.jl Lines 309 to 317 in 23a28b1
|
I just realized that situations where you do many renames (as opposed to just one) your approach might actually end up being faster, because my approach would copy the df index over and over, and yours would instantiate a (non-copying) df once but then you can |
It depends on
Yes, I am aware that there is this difference. However, since If nanosecond speed is needed buy the user it is probably better to switch to type-stable containers. In summary - can the issue and PR be closed? |
Yes! Thank you very much for the clarifications |
Currently there is no way (as far as I can tell, please correct) to rename the columns of a SubDataFrame by either mutating the SubDataFrame (not the underlying DataFrame) or copying the SubDataFrame (but not the underlying DataFrame).
Here's what I've tried so far:
example 1
mutates the underlying DataFrame, you can check by running it twice, it will fail the second time
this is not what i want. also, this only works with some dataframes, see example 3
example 2
this filters and copies the underlying DataFrame into a new DataFrame
also not what i want, i don't want to copy the data
example 3
rename! only works on some subdataframes
The text was updated successfully, but these errors were encountered: