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

Example request #59

Open
hhoeflin opened this issue Jul 19, 2018 · 4 comments
Open

Example request #59

hhoeflin opened this issue Jul 19, 2018 · 4 comments

Comments

@hhoeflin
Copy link

Hi,

I am an avid dplyr user in R and somewhat new to python. I have been looking for a dplyr-like package in python for a while when I came across dfply which looks pretty close to what I was looking for.

Please excuse if this is not quite the right forum, but I was looking for some help/request some documentation/request a feature.

My use case essentially is that I have a function that operates on single elements of a data-frame columns, e.g.

my_func(a,b)

where both a and b are single elements from columns of a data frame. I have found a stackoverflow-post that shows this for an operation on a single column only.

https://stackoverflow.com/questions/42671168/dfply-mutating-string-column-typeerror

The solution show here of using X.file.apply for the column X.file in the data-frame seems to only work when you only have a single column to operate on.

What i was essentially wondering is - how do you recommend to best use dfply in this context? Could you add some documentation on how best to use functions that don't natively understand Series objects?

E.g. could there be an "Intention" like object that takes a function that operators on several parameters, each of which is intended to be a single element from a column, "vectorizes" this function and then when passed an intention object representing a "Series", applies this appropriately?

Thanks for your help!

@sharpe5
Copy link

sharpe5 commented Jul 19, 2018 via email

@sharpe5
Copy link

sharpe5 commented Jul 19, 2018 via email

@hhoeflin
Copy link
Author

hhoeflin commented Jul 19, 2018

thanks for this, I saw that this would work - but it is somewhat cumbersome in my mind compared to native dplyr in R. Essentially with this, much of the nicety and ease of flow of writing dplyr goes away.

Would there be a possibility of an explicit "Intention" based object that would do exactly this, i.e. a wrapper EF i.e. for element_function), that wraps a function that takes elements of a vector as arguments, automatically iterates over the series element?

It is just that any requirement to have "decorates" breaks the natural piping flow of dplyr, and having to prepare it all beforehand breaks the reading-flow of the code.

@sharpe5
Copy link

sharpe5 commented Jul 19, 2018 via email

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

No branches or pull requests

2 participants