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

Add median() to ndframe #176

Merged
merged 2 commits into from
Apr 13, 2020

Conversation

mesejo
Copy link
Contributor

@mesejo mesejo commented Apr 13, 2020

Includes:

  • Add implementation of median
  • Add docstring of std, var and, median
  • Run black

add median, std, and var documentation
run blacken
@elasticmachine
Copy link

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@sethmlarson
Copy link
Contributor

Jenkins test this please

Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

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

This change looks great, one tiny comment!

eland/ndframe.py Outdated
Examples
--------
>>> df = ed.DataFrame('localhost', 'flights')
>>> df.std() # doctest: +SKIP
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be .var()?

Copy link
Contributor Author

@mesejo mesejo Apr 13, 2020

Choose a reason for hiding this comment

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

Yes it should. Done, :)

@mesejo
Copy link
Contributor Author

mesejo commented Apr 13, 2020

@sethmlarson Regarding the refactoring, here are my thoughts:

At least aggs, _metric_aggs, and describe share functionality. All of the functions built aggregation queries, perform some operations, and extract the information from the aggregation. My suggestion is to extract the built aggregation and extraction functionalities from those functions into separate functions (some candidates): built_agg_query and extract_agg_response and refactor the above mentioned functions.

Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

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

LGTM

@sethmlarson
Copy link
Contributor

sethmlarson commented Apr 13, 2020

@mesejo Would be good to keep terms_aggs() and hist_aggs() in mind as well but don't have to really worry about them yet.

I like the idea of build_X_query() and extract_X_response(). Would be good on the extract_X_response() to have the return type be something that can be returned into a pd.DataFrame() or pd.Series() so it can be used within agg() which returns DataFrame and the individual aggs like median() that return a Series.

Would you be willing to create a quick mockup and submit as a PR? Doesn't need to be mergeable or tested, just something to review and think about how this might look. :) Thanks for your hard work btw, it's really appreciated.

@sethmlarson sethmlarson merged commit e8f307d into elastic:master Apr 13, 2020
@mesejo
Copy link
Contributor Author

mesejo commented Apr 13, 2020

@sethmlarson I'm willing to do it, but I cannot guarantee that I can deliver it fast. Thank you, :)

@sethmlarson
Copy link
Contributor

@mesejo No worries! Don't break your back over it, the work and design input you're doing now is already more than expected. 🎉

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.

3 participants