Skip to content
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

minor fixes #916

Closed
wants to merge 4 commits into from
Closed

minor fixes #916

wants to merge 4 commits into from

Conversation

tpapp
Copy link

@tpapp tpapp commented Feb 16, 2016

  • fix a deprecation warning about [] being used for concatenation
  • add similar methods for DataFrameRows
  • add some setindex! for DataFrameRowss as values, setting DataFrames

I found the latter two idiomatic when used in loops with eachrow. Tests are of course included.

Useful for working with DataFrameRow objects, allowing, for example, a
natural selection-partition-accumulation idiom when iterating over an
eachrow(dataframe).
@@ -5,7 +5,7 @@ immutable DataFrameRow{T <: AbstractDataFrame}
end

function Base.getindex(r::DataFrameRow, idx::AbstractArray)
return DataFrameRow(r.df[[idx]], r.row)
return DataFrameRow(r.df[collect(idx)], r.row)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you simply remove the innner [ ] here? getindex(::DataFrame, idx) should take care of the rest.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to make a minimal modification originally, but I see your point. I removed collect and updated the PR. Tests run fine, so if it had a role it is not immediately apparent.

@nalimilan
Copy link
Member

See #912 about fixing the tests. Should be good to merge despite the failures.

@nalimilan
Copy link
Member

Sorry for the delay. Would you rebase now that the tests pass? Then should be good to merge.

@tpapp
Copy link
Author

tpapp commented Apr 27, 2016

Certainly, will do it within the next few days.

@quinnj
Copy link
Member

quinnj commented Sep 7, 2017

still relevant?

@nalimilan
Copy link
Member

Bump.

@bkamins bkamins mentioned this pull request Jan 15, 2019
31 tasks
@bkamins
Copy link
Member

bkamins commented Jun 10, 2019

Thank you for the PR proposal.

The [] issue is fixed.

setindex! with implicit broadcasting will be deprecated soon.

Therefore from this PR we are left with similar. I am not sure how useful similar on DataFrameRow is (given it is a view and similar for array views allocates arrays, which in case of DataFrameRow would be NamedTuple, which is immutable). In what cases would you use it (frankly - I do not see any).

@bkamins
Copy link
Member

bkamins commented Jul 24, 2019

@tpapp Given v0.19.0 changes I would close it. The only thing that you propose that is not covered is similar for a DataFrameRow. We currently do not provide it - what would be the actual use for similar of DataFrameRow keeping in mind that materializing DataFrameRow produces a NamedTuple?

CC @nalimilan

@bkamins bkamins closed this Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants